Adding the Visual Studio 2008 Command Prompt to your Explorer Context Menu
Published November 26th, 2008 in ProgrammingRecently 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!
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”
Please Wait
Leave a Reply