Share via

Setting the Path and Environment Variables for Command-Line Builds

The vcvars32.bat file sets the appropriate environment variables to enable 32-bit command-line builds. For information on how to enable a 64-bit toolset at the command line, see How to: Enable a 64-Bit Visual C++ Toolset at the Command Line.

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.


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




Linker Options

Compiler Options

Other Resources

Building on the Command Line

Compiling a C/C++ Program