ObjectSharp Blogs

You are currently viewing

Dave Lloyd's 2 Cents

A .NET Developer's Perspective


Visual Studio Command Prompt

Here is another useful tip from Mark Comeau, this guy needs his own Blog. Then again I'm glad he hasn't got one. What would I write about. :)

Do you find yourself in the Visual Studio Command Prompt from time to time? Of course you do. Do you get to it via:

Start->Programs->Visual Studio .Net 2003->Visual Studio .Net Tools->Visual Studio .NET 2003 Command Prompt

Hopefully you have a shortcut that is closer to your desktop or start menu.

When you open it what directory are you in? Do you have to then use your vast knowledge of command line directory traversal to get to your source code or whatever it is your looking for?

Would you like to right click on a directory in windows explorer and open a Visual Studio Command Prompt already set to that directory?

Just add these entries to your registry:

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmd_vs]
@="Open VS Command Prompt Here"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmd_vs\command]
@="cmd.exe /k \"C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Common7\\Tools\\vsvars32.bat\""

If you would like the same functionality from a Drive also add this to your registry.

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Drive\shell\cmd_vs]
@="Open VS Command Prompt Here"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Drive\shell\cmd_vs\command]
@="cmd.exe /k \"C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Common7\\Tools\\vsvars32.bat\""


Thanks Mark thats a good one.


 

Comments

  • dave December 11, 2003 9:22 AM

    Don't forget you can also put a a VS Command Prompt in your External Tools - and drop it on your toolbar. Combine this with the fact that you can pass the project directory as an argument and then you can quickly select a project from the solution explorer - click the toolbar button - and Bam! you're in the vs cmd prompt in that folder.

    When you add the external Tool (Tools>External Tools), specify the following:

    Title: VS Command Prompt
    Command: C:\WINDOWS\SYSTEM32\cmd.exe
    Arguments: /k "c:\PROGRA~1\Micros~3.NET\Common7\Tools\vsvars32.bat"
    *yes have to use short paths for some reason
    Initial Directory: $(ProjectDir)

    I find this very handy. I've got an Explorer button on my toolbar as well - much simpler...
    Title: Explorer
    Command: explorer
    Arguments: $(ProjectDir)

  • TrackBack August 1, 2004 5:49 PM

  • TrackBack August 1, 2004 5:50 PM

  • dave May 23, 2006 3:47 PM

    Here's one for Visual Studio 2005. Pretty handy to have if you need a VS command prompt from Windows Explorer.

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmd_vs2005]
    @="Open VS2005 Command Prompt Here"

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmd_vs2005\command]
    @="cmd.exe /k \"C:\\Program Files\\Microsoft Visual Studio 8\\VC\\vcvarsall.bat\""

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Drive\shell\cmd_vs2005]
    @="Open VS2005 Command Prompt Here"

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Drive\shell\cmd_vs2005\command]
    @="cmd.exe /k \"C:\\Program Files\\Microsoft Visual Studio 8\\VC\\vcvarsall.bat\""

Leave a Comment

(required) 
(optional)
(required) 

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS