TIP: Adding "Command Prompt Here" Context Menu

Posted by Dan on Dec 7, 2005 @ 11:01 AM

I often find myself needing to open up a command line on a specific directory. Since Windows Explorer is almost always open on my machine while I'm developing, it makes perfect since that I'd want to use Windows Explorer to open up a command line prompt in a specific directory via the context menu. How can you do this you ask? You edit the registry.

This is not a new tip. It's been around since Windows 95. There's even been a Microsoft PowerToy that does this for every version of Windows, but essentially all it does is create some registry entries for you. I prefer manually editing the registry, as I then have complete control over how I want the listing to appear.

  1. Open regedit
  2. Navigate to HKEY_LOCAL_MACHINE/Software/Classes/Folder/Shell
  3. Create a new key called command prompt
  4. Your default value should be Command Prompt Here
  5. Create a new key called commandunder the command prompt key
  6. Your default value should be cmd.exe /k pushd %L

Feel free to change the "Command Prompt Here" setting to however you want the listing to appear in your context menu. If you prefer, you can take the code below, save it as "command_prompt.reg" and then merge it to your Registry by right-clicking on the file and choosing "Merge".

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\command prompt]
@="Command Prompt Here"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\command prompt\command]
@="cmd.exe /k pushd %L"
Categories: JavaScript, Potpourri, Personal, Technology, HTML/ColdFusion, Flex/Flash, Java

1 Comments

  • Shouldn't the value for the registry key with the pushd be:

    @="cmd.exe /k pushd %1"

    (Use %1 instead of %L)

Add Comment

Leave this field empty