JSI Tip 6300. %APPDATA% environment variable does NOT expand when added to the PATH?
February 3, 2003
If you open a CMD prompt and type set %APPDATA%, the environment variable expands to the path to your Application Data folder.
If you use Control Panel / System / Advanced / Environment Variables or you right-click My Computer, press Properties, select the Advanced tab, and press Environment Variables (or Settings), when you add ;%APPDATA% to your path and apply the changes, the %APPDATA% variable does NOT expand. This behavior prevents you from starting a program from your Application Data folder by just typing the program name.
Apparently, there is a bug in the Shell32.dll library that is causing this problem. As of this writing, the bug exists in Windows 2000 and Windows XP.
To workaround this behavior:
1. Remove the ;%APPDATA% string from the PATH environment variable.
2. Right-click My Computer and press Manage.
3. Right-click Computer Management (Local) and press Properties.
4. Select the Advanced tab.
5. Press Environment Variables.
6. Add the ;%APPDATA% string to the PATH environment variable.
7. Press OK until the change is applied.
8. Close all related dialog boxes.
NOTE: You can use this method with any environment variable.
About the Author
You May Also Like