SEARCH

How-To Geek

Add the Command Prompt to the Windows Explorer Right-Click Menu

A hidden functionality in Windows allows you to right click on a directory, and select “Command Prompt Here” from the menu.

Here’s the registry hack to get this working. Make sure you back up your registry just in case. I’ll show you the step-by-step method, but you can skip down to the bottom for the alternate reg file.

Step-By-Step Method:

Type regedit.exe into the Start\Run dialog, and then navigate to the following registry key:

HKEY_CLASSES_ROOT\Directory\shell

Once you are at that key, right click and choose the New Key option:

Name the key “CommandPrompt” without the quotes and then double-click on the default value. Change the text to “Command Prompt Here” as seen here:

Right click on the new Command key and select New key, as you did before. Name the new key Command as well, and then double-click the default value of that key. Set the text of that key to this:

cmd.exe /k cd %1

You can see what it should look like here:

Now when you right click on the folder, you should see this dialog:

That will open up a prompt like this:

 

Alternate method:

You can create a text file named anything.reg, and insert this text into it:

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\CommandPrompt]
@=”Command Prompt:”
[HKEY_CLASSES_ROOT\Directory\shell\CommandPrompt\Command]
@=”cmd.exe /k cd %1″

Double click on that file, and the text will be entered into the registry, and you’ll have the same right click command prompt.

Another Alternate Method:

You can download the powertoy from Microsoft that provides the same functionality:

http://www.microsoft.com/windowsxp/pro/downloads/powertoys.asp

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 11/25/06

Comments (15)

  1. Krishma Sood

    Nice and easy to implement..

  2. Mario

    Very nice, very useful!

  3. Alex Anderson

    Thanks a lot. It’s a great idea.

  4. Shaunette

    Do I follow the same procedure to undo this? Please help….

  5. manish

    hey Man

    to good really i am damn impressed god work man.and its availabe for us.
    thanks a ton :)

    hope you will continue like this

    take care

    Manish

  6. lliz0

    Great idea!!! Thanks for sharing the trick man

    take care

  7. Ionatan

    Hi, I had this a while ago, but completly lost how to do it. Here is a fix to make it work with folders with an & in its name:

    cmd.exe /k cd %1

  8. Thomas

    Just a comment on the reg code posted under “Alternate Method:”.

    The last quotation is unicode…If you copy-paste into a .reg file, it’ll warn you about saving unicode.
    Looking at the file, that last quotation is replaced with a question mark.
    If you just change it back to a regular quotation, it works fine.

    Not sure if this affects anyone else…Just thought I’d mention it.

  9. Chol

    does this need system to be restart? it is not on my computer

  10. Chol

    it is not working on my computer

  11. fgufgme

    ” code is wrong.
    :p
    :p
    :p

  12. kanggot666

    Hey,i just viewed the article. I havent tried the code yet, by any chance, is this case sensitive?

  13. Chris

    For windows 7 it is:

    cmd.exe /s /k pushd “%V” – this will open a command prompt window from

    The changes in registry are instantaneous, no restart required.
    It really works! :))

    PS: @Thomas is right!

  14. Michael

    How To Add the Command Prompt to the Desktop Right-Click Menu. Please help me. Thanx..

  15. sammay

    Hi, is there any way to create a context menu entry to run commandline programs without manually opening cmd.exe first?

Get Free Articles in Your Inbox!

Join 134,000 newsletter readers

Email:

Go check your email!