SyntaxHighlighter

Thursday, February 2, 2012

Open the Windows Command prompt at the selected folder

Windows 7
I am always open to anything that will allow me to work more efficiently. Way back in Windows XP, the various sysutils would install a context menu into Windows Explorer that would allow us to open the command prompt with the selected folder set as the current directory. ContextConsole Shell Extension is another tool which will do the same for the Windows 7 environment.

However, with Windows 7, you no longer need to install additional extensions and software. Instead, the context menu option, "Open command window here", is available by holding down the shift key and right clicking on the folder.



You can perform this function on any local folder. The command line window will open with the selected folder as the current working directory. You can also perform the SHIFT+RIGHT CLICK on the desktop. Clicking on "Open command window here" will open your command prompt at your desktop directory.

DOS does not support UNC paths and so opening a folder on a UNC path using the "Open command window here" would be pretty much meaningless. So the guys at M$ have gone a little further on this one. When using "Open command window here" on a UNC pathed folder, the function will automatically map a drive letter to the first folder on the UNC path.

For example, I have a development server with a file share. A typical folder path might be "\\WINDEV\DevShare\Systems\MicroCombud". If I was to use "Open command window here" on the MicroCombud folder, the function would automatically map a Z: drive to "\\WINDEV\DevShare" and open the command prompt at "Z:\Systems\MicroCombud". The drive letter map will always map drives in descending order, starting at Z, depending on letter availability. It would be interesting to see what would happen if all drive letters were already used.

No comments: