Tuesday, December 2, 2014

Opening Network Folders in Command Prompt from Windows Explorer

A favorite Windows shortcut of mine is to open a specific folder in a Command Prompt, by typing "cmd" in the address bar of a Windows Explorer window.

This saves a little time, and a serious number of keystrokes, compared to opening a Command Prompt, and using "cd" to navigate down to the desired folder, which may be deeply buried in the folder hierarchy and contains long foldernames that are a pain to type, even with "tab-completion".

However, by default, this shortcut does not work with UNC (Universal Naming Convention) paths. Or in plain English, you cannot jump to a "Network folder" like that, resulting in the following error.

However, this is easily fixed by modifying a registry key, as per Microsoft Knowledge Base number 156262.

  1. Open Registry Editor (Start -> Run -> regedit)
  2. Navigate to HKEY_CURRENT_USER -> Software -> Microsoft -> Command Processor
  3. Add a new the DWORD value with the name DisableUNCCheck 
  4. Set the value to 1 (Hexadecimal)

What the article does not say are:

  • It works with Windows 7 64-bit.

    By extension, I believe it should also work in Windows Vista 32-bit and 64-bit, Windows 7 32-bit.

    (Please comment if you have tested it working in those versions, or in Windows 8. Thanks!)
  • It works in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor

    I personally find it makes more sense for me to apply this setting in "HKEY_LOCAL_MACHINE\SOFTWARE\", as I would prefer it to apply to all the accounts I use, rather than in "HKEY_CURRENT_USER\SOFTWARE\", where it will only apply to the current user.

    My use case is where I have multiple accounts on a personal Windows laptop. If this is applied to a multi-user system (eg. Windows Server), applying a per-user setting in "HKEY_CURRENT_USER\SOFTWARE\" definitely makes more sense.
  • It works (close to) immediately, without needing a reboot or re-login.

    In my case, the first time I tried using the shortcut, which as a few seconds after modifying the registry, the error message occured.

    But my subsequent attempt succeeded, so there appears to be a number of seconds before the registry change took effect. YMMV!
I am now a happy user!

No comments: