Freigeben über


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

  • Anonymous
    September 18, 2006
    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.

  • Anonymous
    September 18, 2006
    Awesome!! those are great secrets to know this one and your new one!!

    Cheers,

    ET

  • Anonymous
    September 18, 2006
    It would also be great if this worked in the TreeView to the left if you choose Show Folders in the shell...

  • Anonymous
    September 18, 2006
    Nice! But when do we get "Open PowerShell Prompt" here? :)

  • Anonymous
    September 18, 2006
    Tim Sneath vient de publier 2 astuces pour Windows VISTA:Open Command Prompt Here Copy as Path Je dois...

  • Anonymous
    September 18, 2006
    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...

  • Anonymous
    September 18, 2006
    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).

  • Anonymous
    September 18, 2006
      3 petites astuces sous Vista. A mon avis, ca ne fait que commencer, il va y avoir plein de petit...

  • Anonymous
    September 18, 2006
    Did anyone also notice the other option "Copy as Path"?

  • Anonymous
    September 18, 2006
    The comment has been removed

  • Anonymous
    September 19, 2006
    Thanx !
    Japanese RC1 enable too !

  • Anonymous
    September 19, 2006
    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.

  • Anonymous
    September 19, 2006
    PingBack from http://vista.technoreality.com/2006/09/19/windows-vista-secret-1-open-command-prompt-here/

  • Anonymous
    September 19, 2006
    Nice,

    it's the little things that make RC1 so much fun ;-)

  • Anonymous
    September 19, 2006
    PingBack from http://quintessential.wordpress.com/2006/09/19/windows-vista-secret-1/

  • Anonymous
    September 19, 2006
    Now, if only Vista's cmd.exe didn't need to create a temporary drive mapping for network paths, THAT would be useful.

  • Anonymous
    September 20, 2006
    Tim Sneath is on a roll with his series of Windows Vista Secrets posts, and rumour has it he has something...

  • Anonymous
    September 21, 2006
    PingBack from http://vista.pcplace.biz/2006/09/19/windows-vista-secret-1-open-command-prompt-here/

  • Anonymous
    September 21, 2006
    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

  • Anonymous
    September 21, 2006
    PingBack from http://cyber-knowledge.net/blog/2006/09/21/5-windosws-vista-secrets-you-must-know/

  • Anonymous
    September 22, 2006
    PingBack from http://tech.cybernetnews.com/2006/09/20/open-command-window-here-built-into-vista/

  • Anonymous
    September 26, 2006
    Smart Client. Mucho se ha hablado sobre las limitantes de internet en alta interactividad. Cada...

  • Anonymous
    October 14, 2006
    did anyone notice you can now rename the Recycle Bin like any other file or folder without going into the registry? little things....neat.

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

  • Anonymous
    November 05, 2006
    The comment has been removed

  • Anonymous
    November 17, 2006
    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...?

  • Anonymous
    November 18, 2006
    The comment has been removed

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

  • Anonymous
    December 16, 2006
    Works in XP (media centre edition) as well. Maybe it works in other versions of windows.  Very useful.

  • Anonymous
    January 24, 2007
    The comment has been removed

  • Anonymous
    June 10, 2007
    I'm probably the last person to pick up on this little Vista Feature but you don't need to use

  • Anonymous
    July 30, 2007
    Tim Sneath hat einige sehr hilfreiche Windows Vista Secrets veröffentlicht die euch das Leben mit dem...

  • Anonymous
    August 21, 2007
    When ever I start getting into some development, I soon return to needing my old "Command Prompt Here"

  • Anonymous
    January 01, 2008
    The comment has been removed