Caching of path environment variable on windows?

Posted by jwir3 on Server Fault See other posts from Server Fault or by jwir3
Published on 2011-02-09T17:24:50Z Indexed on 2012/08/31 3:40 UTC
Read the original article Hit count: 435

I'm assisting one of our testers in troubleshooting a configuration problem on a Windows XP SP3 system. Our application uses an environment variable, called APP_HOME, to refer to the directory where our application is installed. When the application is installed, we utilize the following environment variables:

APP_HOME = C:\application\
PATH = %PATH%;%APP_HOME%bin

Now, the problem comes in that she's working with multiple versions of the same application. So, in order to switch between version 7.0 and 8.1, for example, she might use:

APP_HOME = C:\application_7.0\ (for 7.0)

and then change it to:

APP_HOME = C:\application_8.1\ (for 8.1)

The problem is that once this change is made, the PATH environment variable apparently still is looking at the old expansion of the APP_HOME variable. So, for example, after she has changed APP_HOME, PATH still refers to the 7.0 bin directory.

Any thoughts on why this might be happening? It looks to me like the PATH variable is caching the expansion of the APP_HOME environment variable. Is there any way to turn this behavior off?

© Server Fault or respective owner

Related posts about environment-variables

Related posts about windows-xp-sp3