How to specify Environment variables in project settings by using Visual C++ .NET or Visual C++ 2005 (311933)



The information in this article applies to:

  • Microsoft Visual C++ 2005 Express Edition
  • Microsoft Visual C++ .NET (2003)
  • Microsoft Visual C++ .NET (2002)

This article was previously published under Q311933

SUMMARY

This step-by-step article describes how to use Environment variables in Visual C++ .NET or Visual C++ 2005.

back to the top

Specify File Paths in Visual C++

There are two methods that you can use to specify file paths in Visual C++:
  • Use built-in predefined macros that are included in Visual C++.
  • Use Environment variables.
An Environment variable can be a system variable or a user variable with an associated value. You can use Environment variables to set project properties such as the input file path or the output file path.

back to the top

How to Use Environment Variables

You can use an Environment variable in the same way that you use built-in Visual Studio .NET macros. For example, to use an Environment variable named MyEnvVar, type $(MyEnvVar) in the appropriate Properties field for your project.

back to the top

How to Set Environment Variables in Microsoft Windows Server 2003, in Windows 2000, and in Windows XP

To set Environment variables in Windows Server 2003, in Windows 2000, or in Windows XP, follow these steps:
  1. Click Start, point to Settings, and then click Control Panel.
  2. Double-click System.
  3. On the Advanced tab, click Environment Variables.
  4. Under User or System variables, click New.

    Note In Windows Server 2003, click New under User variables for <Computer Name>.
  5. In the Variable Name text box, type the name of the Environment variable that you want to add.
  6. In the Variable Value text box, type the value of this new variable.
  7. Click OK to save the new variable.
back to the top

Modification Type:MajorLast Reviewed:1/17/2006
Keywords:kbHOWTOmaster KB311933 kbAudDeveloper