How can I open a command prompt at my current directory in Explorer?

John Savill

January 8, 2000

2 Min Read
ITPro Today logo in a gray background | ITPro Today

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

  1. Start the Registry Editor (regedit.exe)

  2. Move to HKEY_CLASSES_ROOTFoldershell (you could use HKEY_CLASSES_ROOTDirectoryshell but it would then not apply to folders, whereas Folder does both)

  3. From the Edit menu select New - Key and enter a name of CmdHere (or anything else)

  4. Under the new key select New - Key and enter a name of command (lowercase)

  5. 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 Prompt Here"
    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.

  6. Move to the command key and again double-click (Default) and enter
    System32cmd.exe /k cd "%1"
    e.g. c:winntSystem32cmd.exe /k cd "%1"
    You can use "%l" instead of "%1" which will support long file names.

  7. Close the registry editor

An example registry file might look like:

[HKEY_CLASSES_ROOTFoldershellCmdHere]@="Command Prompt Here" [HKEY_CLASSES_ROOTFoldershellCmdHerecommand]@="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

Click here to view image

In Windows 2000 applying this change also results in a command prompt here for drives and not just folders

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like