Did you ever have the need to use different versions of Microsofts Visual C++ compiler from the command line? Did you wish you wouldn’t have to constantly call vcvars32.bat or change your environment (PATH, INCLUDE and LIB variables)?

In comes a little tool called envvc.exe. It sets the environment for the chosen version and then calls any chosen executable. As additional feature it verifies that you have installed the latest service pack for the chosen version.

Supported configurations:

  • VC 6, example:
    envvc 60 cl ...
    Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
  • VC 7.1 (VS 2003). Example (without the current SP1, simulating an error message):
    envvc -f 71 cl ...
    C:\Program Files\Microsoft Visual Studio .NET 2003\install.htm(1) : error SP: there's a newer service pack available!
    Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
  • VC 8 (VS 2005) Example:
    envvc 80 cl ...
    Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86
  • VC 8 with the .NET 3 SDK. Example:
    envvc fx 80 svcutil ...
    Microsoft (R) Service Model Metadata Tool
    [Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.30]

No configuration is needed for envvc; all informations about where the compilers are installed and which service packs have been applied are read from the Windows Registry. But the known service packs are hard coded, so you have to patch envvc whenever Microsoft releases another service pack.

The source to envvc is available under the Boost Software License (local copy): envvc.cpp. Feedback is appreciated!

Update 2017-01-02:

This entry was posted in Hug-Witschi, Programming. Bookmark the permalink.

Comments are closed.