Windows Vista Secret #1: Open Command Prompt Here


I don’t know about your workflow as a developer, but I often find myself switching back and forward between an Explorer window and the command shell. For example, sometimes I’m looking around the filesystem for a project that I created a while back and then I want to build it from the command line or rename some of the files or something.

Here’s a trick that I don’t think many people are aware of. Right-click on any folder on your Windows Vista machine while holding down the shift key. You’ll see an extra context-sensitive menu item there: Open Command Prompt here. Just click on this menu and a command window will open with the current working directory set to the folder’s actual location.


Figure: folder context-sensitive menu, with and without the shift key modifier.

In the past there was a Windows XP powertoy that did this; now it’s built into the operating system (albeit hidden away to protect the unwary from themselves). What’s really cool about this is that if the target folder is a network location, Windows Vista silently maps a network drive to that location before opening the folder (so that your command prompt has a valid path containing a drive letter) and then deletes the network drive once the command prompt is closed.

Comments (34)

  1. Brandon Ording says:

    I really do like that this is included in Vista without the need of a powertoy, but is there any way to use it to get an elevated command prompt? Sometimes you just need full Admin rights, and having a way to do that would be very nice.

  2. Etienne says:

    Awesome!! those are great secrets to know this one and your new one!!

    Cheers,

    ET

  3. Anonymous says:

    It would also be great if this worked in the TreeView to the left if you choose Show Folders in the shell…

  4. Kevin Dente says:

    Nice! But when do we get "Open PowerShell Prompt" here? :)

  5. Tim Sneath vient de publier 2 astuces pour Windows VISTA:Open Command Prompt Here Copy as Path Je dois…

  6. I think I remember there being a way to get all command prompts to run the vsvars batch file so that the command prompt is actually usable. Do you remember what this is? I think it was a registry setting…

  7. tims says:

    Josh, you’re correct – it’s a registry setting.

    In HKLMSoftwareMicrosoftCommand Processor, add a new String value named AutoRun. Set the contents to the batch file you’d like to run (e.g. d:toolsmycustomvsvars.cmd).

  8.   3 petites astuces sous Vista. A mon avis, ca ne fait que commencer, il va y avoir plein de petit…

  9. That guy says:

    Did anyone also notice the other option "Copy as Path"?

  10. David James says:

    Nice posts on this and Copy As Path –  makes me want to install Vista on my main PC!

    Re "if the target folder is a network location, Windows Vista silently maps a network drive" – just wanted to share the tip that "pushd" will do this from the command line. It’s like "cd" but accepts network paths. "popd" will unmap the drive. (This is not new for Vista though, it’s available on XP’s command shell and maybe earlier).

  11. barlog says:

    Thanx !

    Japanese RC1 enable too !

  12. hswear3 says:

    Unfortunately, the usefulness of this feature is limited because it will not work from folders or drives in the "Folder Pane" of Windows Explorer as it did in the Power Toy version for Windows XP.

    For a way to add the full Power Toy functionality, consult my blog at http://vistahacks.wordpress.com

    My technique does does not automatically map network drives though.

  13. conmulligan says:

    Nice,

    it’s the little things that make RC1 so much fun 😉

  14. RubenP says:

    Now, if only Vista’s cmd.exe didn’t need to create a temporary drive mapping for network paths, THAT would be useful.

  15. Tim Sneath is on a roll with his series of Windows Vista Secrets posts, and rumour has it he has something…

  16. You guys are idiots.  This is not a vista secret. You don’t need vista or powertoys for command prompt here.  Its just a registry entry.

    (see method 5.)

    http://www.petri.co.il/add_command_prompt_here_shortcut_to_windows_explorer.htm

  17. Smart Client. Mucho se ha hablado sobre las limitantes de internet en alta interactividad. Cada…

  18. digi says:

    did anyone notice you can now rename the Recycle Bin like any other file or folder without going into the registry? little things….neat.

  19. Tim Sneath says:

    Ever wanted to copy a link from a network file share into an email, and wound up having to traverse the

  20. JAy says:

    Hmm. just type cmd on the seach box. simple job done

  21. woody says:

    Hmm, it is cool it maps the drive for you, but sad at the same time that Windows still relies on assigning drive letters to work with network drive and the cmd prompt.  There really shouldn’t be any reason to do that anymore since the cmd prompt isn’t really DOS anymore…?

  22. ur mother says:

    Wow…that’s sexy! What a neat feature (talking about the automatic mapping of a network resource for cmd lines)!!

  23. Tim Sneathが彼のブログで「Windows Vista Secret」という連載(?)をやっています。役に立ちそうなものもあるので、ここでタイトルだけ日本語化して紹介します。詳細は(英語ですが)リンク先を見てください。

  24. Colm says:

    Works in XP (media centre edition) as well. Maybe it works in other versions of windows.  Very useful.

  25. .NET 3.0 has a number of command line utilities like the service utility (svcutil.exe) that can be awkward

  26. I'm probably the last person to pick up on this little Vista Feature but you don't need to use

  27. Tim Sneath hat einige sehr hilfreiche Windows Vista Secrets veröffentlicht die euch das Leben mit dem…

  28. When ever I start getting into some development, I soon return to needing my old "Command Prompt Here"

  29. Khurram Aziz says:

    Hibernation To Hibernate; use >shutdown /h , I cant find any menu for this in Vista atleast here at