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

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_ROOT\Folder\shell (you could use HKEY_CLASSES_ROOT\Directory\shell 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
    \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.
  7. Close the registry editor

An example registry file might look like:

@="Command Prompt Here"
@="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

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.