+5  A: 

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.

ChrisF
The latter, I would suggest.
Alex
+1. Overall probably safer to have your command line (PATH etc.) set to give a consistent environment for a single environment. Not everything is in one folder, there are multiple paths that are needed (otherwise you could find command line builds using different compilers to IDE builds). VS includes batch files (and installs shortcuts to cmd instances using them) that can guide you.
Richard
A: 

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.

D.Shawley
+2  A: 

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.

Igor Zevaka
+1 For me `devenv` always opened Vs2010. But I needed vs2008 sometimes and I don't like Start>programs.... Thanks this helped me.
Ismail
+2  A: 

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.

kenny
If on Windows 7, docking them both to Task bar is even easier.
Lex Li
Squeaks like a mouse?
kenny
+1  A: 

You can try in this way to open VS2008 from command using "devenv"

Steps:

  1. Open regeistry editor by typing regedit on Run

  2. Locate and open the following key My Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\devenv.exe

  3. Currently your devenv.exe mapped to C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.exe -- This is for VS2005

    If you want open VS2008 from Command, 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

In this way you can switch to VS2005 to VS2008 or VS2008 to VS2005

Hope this post is usefull :)

Prasad Kanaparthi

Bangalore.

Prasad Kanaparthi
A: 

@ Prasad

Your method works perfectly !!

Thanx

sri.net
@sri.net: you can comment in @prasad's answer, instead posting a whole new answer just for appreciation.
Prashant
A: 

Hi Prasad,

It is working fine with Windows 7 professional edition also.

Thanks, Thirunavukarasu

Thirunavukarasu