This documentation is archived and is not being maintained.

Setting the Path and Environment Variables for Command-Line Builds

The vcvars32.bat file sets the appropriate environment variables to enable command-line builds.

Note that if you are doing command-line builds with DEVENV, vcvars32 settings will have no affect on your builds, unless you also specify the /useenv option.

To run vcvars32.bat

  1. At the command prompt, change to the \bin subdirectory of your Visual C++ installation.
  2. Run vcvars32.bat by typing VCVARS32.
Caution   The vcvars32.bat file can vary from computer to computer. Do not replace a missing or damaged vcvars32.bat file with a vcvars32.bat from another computer. Rerun Visual C++ Setup to replace the missing file.

For more information about vcvars32.bat, see the following Knowledge Base article:

  • Q248802 : Vcvars32.bat Generates Out of Environment Message

If the current version of Visual C++ is installed on a computer that also has a previous version of Visual C++, you should not run vcvars32.bat from different versions in the same command window.

CL.exe invokes the preprocessor and compiler, and LINK.exe invokes the linker. (CL can invoke the linker as well, so you do not have to invoke LINK directly in most cases.)

CL.exe, LINK.exe, and other command-line tools require that certain environment variables be properly set:

See Also

Building on the Command Line | Linking | Linker Options | Compiling a C/C++ Program | Compiler Options