A. It may be a normal situation you are browsing directories in Explorer and want to open a command prompt at the current location without having to type a long cd .... to get to the correct directory. It is possible to add a context menu option to folders to bring up a "Command prompt here" which will open a command prompt at your current explorer location.
A Powertoy, Command Prompt Here, can be downloaded from Microsoft (and is also included with the resource kit, cmdhere.inf), however all this does is update a couple of registry entries and can be accomplished manually allowing greater flexibility
- Start the Registry Editor (regedit.exe)
- Move to HKEY_CLASSES_ROOT\Folder\shell (you could use HKEY_CLASSES_ROOT\Directory\shell but it would then not apply to folders, whereas Folder does both)
- From the Edit menu select New - Key and enter a name of CmdHere (or anything else)
- Under the new key select New - Key and enter a name of command (lowercase)
- Under the key (CmdHere), double-click (Default) and enter a name
that will be displayed when you right click on the directory, e.g. "Command
As an extra, if you a & to the front of a character it will cause it to be underlined, e.g. "&John Prompt here" would produce John Prompt here.
- Move to the command key and again double-click (Default) and enter
\System32\cmd.exe /k cd "%1"
e.g. c:\winnt\System32\cmd.exe /k cd "%1"
You can use "%l" instead of "%1" which will support long file names.
- Close the registry editor
An example registry file might look like:
\[HKEY_CLASSES_ROOT\Folder\shell\CmdHere\] @="Command Prompt Here" \[HKEY_CLASSES_ROOT\Folder\shell\CmdHere\command\] @="cmd.exe /d cd \"%1%"
There is no need to reboot the machine and the new option will be available when you right click on a folder
In Windows 2000 applying this change also results in a command prompt here for drives and not just folders