Windows 7 / XP – Right Click to Open a Command Prompt

   Posted August 19, 2010 by David Kirk in Windows

This tech-recipe describes how to open a command prompt by right clicking on a folder in explorer. The tutorial has been updated to include information about Windows 7 as well.

Many of us command prompt guys still like to drop to the command console for particular tasks. Executing cmd.exe from the RUN box still forces you to navigate to the particular folder in question. Wouldn’t be easier to just right click on a folder to open a command prompt in that particular directory?

Windows 7 Systems —

1. Select the folder you want to open in the command prompt
2. Right-click on it while holding the Shift key
3. Select Open command window here

how to open command prompt in windows 7 by right clicking

XP Systems —

Manual Method:
(This requires editing your registry. If you are not familiar with registry editing, this isn’t for you… so skip to the easy method below)
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 Command under the Command Prompt key
6. Your default value should be cmd.exe /k pushd %L

Your popup menu when you right click on a folder will now contain an option called Command Prompt Here which will open a command prompt in the selected folder.

Easy Method:
Microsoft also has developed this ability into one of its powertoys.


About David Kirk

David Kirk is one of the original founders of tech-recipes and is currently serving as editor-in-chief. Not only has he been crafting tutorials for over ten years, but in his other life he also enjoys taking care of critically ill patients as an ICU physician.
View more articles by David Kirk

The Conversation

Follow the reactions below and share your own thoughts.

  • Harry Broekhof

    Works like a charme! Thank you.

  • Kevin

    Current PowerToys page:

    Specifically, the “Open command window Here” tool.

    • Dave

      > That link is dead now too 🙁

  • DellaMedia

    Works Great! Simple and very effective!

  • B.Naresh Naidu

    I want to call from my phone to others using Blootooth. How it possible? please give me answer.

  • Jineeshjohn

    It worked . Thanks

  • Radhe

    Thanks for the simple approach!

  • Bhimsen443

    Nice one… thanks!!!

  • Senseifibonacci

    if you press shift + right click in windows 7 the open command prompt also apears.

    • Senseifibonacci

      Edit: only works on your desktop

  • Gareth

    A slightly better solution is as follows:

    cmd.exe /k “pushd “%L””

    This will allow the handling of directory names with embedded spaces

  • MrZoolook

    Another even more old-school method would be to use:
    cmd.exe /k cd /d “%1”

  • MDE

    Works perfectly, thanks! The XP method works in Windows 7 too, but then you need to use HKEY_CURRENT_USER/Software/Classes/Folder/Shell
    I had to create the Folder and Shell and subsequent keys.

  • Nikhil

    Thanks. I’ll try it on my VMware XP system.

  • Sam

    Any idea if this can also made available in Windows 7 when you click inside the folder? In the “white space” in Windows Explorer when you are inside the folder? And not only when you click on a folder itself?

  • joe


  • Dave

    Is there a reg key, so that it will work if you right click (with or without ctrl or ??? held down too) in the white space of a folder contents area? (like Linux) 😉
    Just curious.

  • zakwan

    dude, me already open from HKEY_LOCAL_MACHINE/Software/Classes/Folder but under the folder there no Shell, only got PersistentHandler…help me please 🙁