Managing Multiple Versions of Visual Studio

In my previous post, I described how to build an old version of GNU Make for Windows. While working on that I wanted to be able to test out different versions of Visual Studio to see if it builds successfully. Quickly switching between versions of Visual Studio was difficult so I created a batch file to help make it a lot easier.

This script takes a single argument that specifies which version of visual studio you want to set up and it then calls the appropriate vsvars32.bat file for that version of Visual Studio.

@echo off

if "%1" == "vs4" goto vs4
if "%1" == "vs6" goto vs6
if "%1" == "vs2003" goto vs2003

goto argerror

:vs4
pushd C:\msdev\bin
call vcvars32 x86
popd
goto done


:vs6
pushd C:\Program Files\Microsoft Visual Studio\VC98\Bin
call vcvars32
popd
goto done


:vs2003
pushd "C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\"
call vsvars32.bat
popd
goto done

:argerror
echo no Visual Studio version specified!
echo usage: setupenv [version]
echo    where version is one of the following: vs4, vs6, vs2003

:done