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

   Posted 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.

18 Responses to “Windows 7 / XP – Right Click to Open a Command Prompt”

  1. January 28, 2009 at 10:14 pm, Harry Broekhof said:

    Works like a charme! Thank you.


  2. March 26, 2009 at 12:57 pm, Kevin said:

    Current PowerToys page:

    Specifically, the “Open command window Here” tool.


    • May 14, 2013 at 3:49 am, Dave said:

      > That link is dead now too :(


  3. June 15, 2009 at 4:29 pm, DellaMedia said:

    Works Great! Simple and very effective!


  4. May 22, 2010 at 9:45 am, B.Naresh Naidu said:

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


  5. September 12, 2010 at 5:34 am, Jineeshjohn said:

    It worked . Thanks


  6. November 11, 2010 at 6:47 am, Radhe said:

    Thanks for the simple approach!


  7. March 05, 2011 at 3:37 am, Bhimsen443 said:

    Nice one… thanks!!!


  8. March 10, 2011 at 4:42 pm, Senseifibonacci said:

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


    • March 10, 2011 at 4:45 pm, Senseifibonacci said:

      Edit: only works on your desktop


  9. March 28, 2011 at 12:12 am, Gareth said:

    A slightly better solution is as follows:

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

    This will allow the handling of directory names with embedded spaces


  10. September 14, 2011 at 6:45 am, MrZoolook said:

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


  11. January 02, 2012 at 5:58 am, MDE said:

    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.


  12. June 06, 2012 at 3:17 pm, Nikhil said:

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


  13. September 17, 2012 at 10:17 am, Sam said:

    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?


  14. December 17, 2012 at 8:40 am, joe said:



  15. May 14, 2013 at 3:51 am, Dave said:

    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.


  16. August 28, 2013 at 9:31 pm, zakwan said:

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


Leave a Reply