About



Erik Burger is a .NET Consultant at Antares Informatisering, an outsourcing company based in The Netherlands. He refuses to specialise in a single programming language as a matter of principle, believing that being multi-disciplinary makes him a better developer. He's a strong advocate of Pragmatic Programming and a newbie enthusiast in Ruby and Rails.

View Erik Burger's profile on LinkedIn


Microsoft Windows SharePoint Services 3.0: Application Development


Disclaimer



All opinions expressed in this blog are solely those of the author and not necessarily those of Antares. You may use all the information provided here but please understand that it is provided "AS IS" and comes with no warranty of any kind.


213


Recently I’ve been exploring the possibilities of MSBuild in my projects. MSBuild is a command-line tool so this involved spending a lot of time at the Visual Studio 2008 Command Prompt. And having to change directories every time I started a new instance really started getting on my nerves. So, Google to the rescue!

I found plenty of posts on the subject but none of them seemed to work for me. So, I modified the one I found here (thanks devsuldier!). Here are the steps to add the VS2008 Command Prompt to the context menu:

1. Using Notepad, create a file called “VS2008Cmd.reg”. Mind the extension!
2. Copy-paste the following lines into the file:

Windows Registry Editor Version 5.00 
 
[HKEY_CLASSES_ROOT\Directory\Background\shell\VS2008 Command Prompt]
@="Open VS2008 Command Prompt Here"
"Extended"=""
"NoWorkingDirectory"=""
 
[HKEY_CLASSES_ROOT\Directory\Background\shell\VS2008 Command Prompt\command]
@="C:\\Windows\\System32\\cmd.exe /s /k \"cd \"%1\" && \"C:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\vcvarsall.bat\"\" x86 "
 
[HKEY_CLASSES_ROOT\Directory\shell\VS2008 Command Prompt]
@="Open VS2008 Command Prompt Here"
"Extended"=""
"NoWorkingDirectory"=""
 
[HKEY_CLASSES_ROOT\Directory\shell\VS2008 Command Prompt\command]
@="C:\\Windows\\System32\\cmd.exe /s /k \"cd \"%1\" && \"C:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\vcvarsall.bat\"\" x86 "
 
[HKEY_CLASSES_ROOT\Drive\shell\VS2008 Command Prompt]
@="Open VS2008 Command Prompt Here"
"Extended"=""
"NoWorkingDirectory"=""
 
[HKEY_CLASSES_ROOT\Drive\shell\VS2008 Command Prompt\command]
@="C:\\Windows\\System32\\cmd.exe /s /k \"cd \"%1\" && \"C:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\vcvarsall.bat\"\" x86 "

3. Save the file. Double-click the file to add the entries to the registry.

Now, when you Shift+Right-Click on a folder you can select the Visual Studio 2008 Command Prompt. Sweet!

Visual Studio Command Prompt

As a side-note, I ran into the problem that my current workplace resets the registry after rebooting. Annoying as hell, but luckily it’s not difficult to create a little startup script to add the entries to the registry every time I boot up:

1. Create a new file “AddVS2008Cmd.bat”. Again, mind the extension.
2. Copy-paste the following lines into the file:

@echo off
@echo -- Adding Visual Studio 2008 Command Prompt to the Explorer Context Menu
regedit.exe /s "VS2008Cmd.reg"

3. Add a shortcut to the Startup folder. To do this, navigate to Start > All Programs, right-click on the Startup folder and select Explore All Users. Then drag the AddVS2008Cmd.bat file to that folder holding Alt key.
4. Set the shortcut to start minimized. This is purely aesthetics. Right-click on the shortcut, select Properties and change the Run property to Minimized.

That’s all there is to it. I hope you’ll find this as much of a time-saver as I have.


0 Responses to “Adding the Visual Studio 2008 Command Prompt to your Explorer Context Menu”

  1. No Comments

Leave a Reply