Tip: Understand and Configure System Environment Variables

Follow Our Daily Tips

Twitter | Blog | RSS | Facebook

System environment variables are handy when you’re setting up the user’s environment, especially when you work with logon scripts. You use environment variables to specify path information that can be dynamically assigned. Here are the most common environment variables:

  • %SystemRoot% The base directory for the operating system, such as C:\Windows. Use it with the Profile tab of the user’s Properties dialog box and logon scripts.
  • %UserName% The user account name, such as wrstanek. Use it with the Profile tab of the user’s Properties dialog box and logon scripts.
  • %HomeDrive% The drive letter of the user’s home directory followed by a colon character, such as C:. Use it with logon scripts.
  • %HomePath% The full path to the user’s home directory on the respective home drive, such as \Users\Mkg\Georgej. Use it with logon scripts.
  • %Processor_Architecture% The processor architecture of the user’s computer, such as x86. Use it with logon scripts.

By using the %UserName% variable, for example, you allow the system to determine the full path information on a user-by-user basis. If you use this technique, you can use the same path information for multiple users, and all the users will have unique settings.

Note: When using the Profile tab, environment variables can lessen the information you need to type, especially when you create an account based on another account.

From the Microsoft Press book Windows Server 2008 Administrator’s Pocket Consultant, Second Edition by William R. Stanek.

Looking for More Tips?

For more tips on using Microsoft products and technologies, visit the TechNet Magazine Tips library.