Reputation: 27185
I have two versions of Visual Studio 2005/208 installed in my system (windows7), when I am opening Visual Studio with "devenv" command from "Run" window then its opening Visual Studio 2005 but I want when I open it using "devenv" command so Visual Studio 2008 should open by default.
How can I do this in windows.
Thanks
Note: I am not sure this question is for Stackoverflow or for Superuser so just asked it here, if this has any problem then (any moderator) please move it to superuser.
Upvotes: 13
Views: 27464
Reputation: 371
You can follow these steps to open VS2008 from the command prompt using "devenv":
Open the Registry Editor by typing regedit
on Run
Locate and open the following key:
My Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\devenv.exe
Currently for VS 2005, devenv.exe
is mapped to
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.exe
If you want open VS 2008 from the command prompt, you must change the map to
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe
Just change to 8 to 9.0 to switch from VS 2005 to VS 2008, or VS 2008 to VS 2005.
Upvotes: 37
Reputation: 22334
My suggestion is to run Launchy, but I also +1ed the batch file approach. I should add, once with that approach I hotkey launchy, win-space for me, and type either '5' or '8' for vs05 or vs08.
Upvotes: 2
Reputation: 76510
This is what i have:
REM devenv8.bat
@echo off
"%VS80COMNTOOLS%..\IDE\devenv.exe"
REM devenv9.bat
@echo off
"%VS90COMNTOOLS%..\IDE\devenv.com"
It flashes command prompt momentarily, but I haven't worked out how to get rid of that. Will be interested to know how to have it not do that.
Upvotes: 6
Reputation: 59563
Make two batch files (devenv-2005.bat
and devenv-2008.bat
) and use them instead of devenv. Make sure to set up the environment appropriately for each one and then launch devenv.exe
using the START
command with a full path name from within the batch. There are utility batch files shipped with Visual Studio that will set up the environment (e.g., INCLUDE
, LIB
, PATH
, etc.) for you. In VS2005, it was named vsvars32.bat
. I would imagine that it is named similarly in VS2008.
The other option is to find the environment script (vsvars32.bat) for VS2008 and modify your user environment to match. I would remove references to VS2005 from the environment altogether just to be safe.
Upvotes: 2
Reputation: 137148
The problem is that both executables are called "devenv.exe".
What will be happening is that while both the 2005 folder and 2008 folder are on your Windows search path, the 2005 folder occurs first. This means that the 2005 version is found first and gets executed.
Possible solutions:
Rename the 2005 copy to be "devenv2005.exe" (for example). However, you will need to update any shortcuts that point to it to use the new name.
Edit your PATH environment variable to swap the order of the 2005 and 2008 directories.
The second is the least work - depending on how confident you are about editing environment variables.
Upvotes: 11