On CNET: Why are geeks flocking to Firefox?

Understanding environment variable precedence in Windows XP

Tags: Microsoft Windows, Greg Shultz, Autoexec.bat, Autoexec.bat file, Environment Variables, environment variable, Environment Variables dialog box, System Variables, dialog box, Microsoft Windows XP

  • Save
  • Print
  • Digg This
  • 1

Takeaway: Have you ever set an environment variable in the Autoexec.bat file and then discovered that the variable has a different value than the one you specified? This is because the variable was probably overridden by the same setting in the Environment Variables dialog box. Discover how to avoid such problems.

Stay on top of the latest XP tips and tricks with our free Windows XP newsletter, delivered each Thursday. Automatically sign up today!

Many IT pros still use the Autoexec.bat file to set environment variables, which is fine in most cases. However, if you set an environment variable in the Autoexec.bat file and then discover that the variable has a different value than the one you specified, the variable was probably overridden by the same setting in the Environment Variables dialog box.

This is because during the startup procedure Windows XP searches the startup files and processes the environment variable settings in the following order:

  • Autoexec.bat files
  • System Variables
  • User Variables

Therefore, if you set the same environment variable in the Autoexec.bat file and in the System Variables section, the value assigned in the System Variables section will override the value assigned in the Autoexec.bat file.

To avoid these types of problems, you might want to get into the habit of setting environment variables in the Environment Variables dialog box. Here's how:

  1. Right-click My Computer and select Properties to open the System Properties dialog box.
  2. Select the Advanced tab and press the Environment Variables button.

From the Environment Variables dialog box, you can set user-specific variables or system-specific variables by pressing the New or Edit buttons and then selecting OK.

  • Save
  • Print
  • Digg This
  • 1

Print/View all Posts Comments on this article

How to do it programmatically?hosamaly6@...  | 03/24/05
RegistryJim Buttery  | 03/24/05

What do you think?

Article Categories

Security
Security Solutions, IT Locksmith
Networking and Communications
E-mail Administration NetNote, Cisco Routers and Switches
CIO and IT Management
Project Management, CIO Issues, Strategies that Scale
Desktops, Laptops & OS
Windows 2000 Professional, Microsoft Word, Microsoft Excel, Microsoft Access, Windows XP,
Data Management
Oracle, SQL Server
Servers
Windows NT, Linux NetNote, Windows Server 2003
Career Development
Geek Trivia
Software/Web Development
Web Development Zone, Visual Basic, .NET

Cracking Open Apple Tech

advertisement
Click Here