/UseEnv (devenv.exe)

Applies to: yesVisual Studio noVisual Studio for Mac noVisual Studio Code

Starts Visual Studio and loads certain environment variables for compilation.


This switch is installed with the Desktop development with C++ workload.


devenv /UseEnv {SolutionName|ProjectName}


  • SolutionName

    The full path and name of a solution file.

  • ProjectName

    The full path and name of a project file.


This switch affects the Visual Studio IDE in the project properties for VC++ Directories. If you specify the /UseEnv switch, the VC++ Directories node shows the values for the PATH, INCLUDE, LIBPATH, and LIB environment variables. (It also shows values for Source Directories and Exclude Directories.) Otherwise, the node replaces the environment variables with five directory values: Executable Directories, Include Directories, Reference Directories, Library Directories, and Library WinRT Directories.


You access the project properties by right-clicking a C++ project and selecting Properties. In the Property Pages dialog box, select Configuration Properties and then VC++ Directories.

When a project name is specified with this switch, the tool displays the environment variables for all projects within the project's parent solution.


The following example starts Visual Studio and loads environment variables into the property pages of the MySolution solution.

devenv.exe /useenv "%USERPROFILE%\source\repos\MySolution\MySolution.sln"

See also