Windows XP Environment Variables

environment-variableswindows xp

I think my PATH in my environment variables is not working properly and would like to ask a few questions about environment variables in general.

  1. What is the difference between User variables and System variables? When should one use one? What if you have i.e. the same variable for both user and system? Does not not matter because the system variables encompass all users?

  2. I'm trying to use shortcuts to make my PATH cleaner. For example, I have set my JAVA_HOME to C:\Program Files\Java\jdk1.6.0_25\bin and then PATH to %JAVA_HOME%\bin. However, when I type in "echo %PATH%" in the cmd, it still shows %JAVA_HOME%\bin. Should I be worried that it is not "C:\Program Files\Java\jdk1.6.0_25\bin"?

  3. If I wanted to check if an xml existed in my path, how would I verify this?

  4. Because some programs don't like spaces in environment variables, it was suggested to use C:\Progra~1\ instead of C:\Program Files\ as shown here: http://ist.berkeley.edu/as-ag/technology/howto/install-java-sdk-win.html What are the procedures to do this? Where do I start the break and add the ~1. Is it always a 1?

Thank you!

Best Answer

  1. The User and System paths are combined when users log in to the system. If no user is logged in, the %PATH% variable will reflect only the System path.

    • User variables are configured on a per-user basis, and only take effect when that particular user is logged in.

    • The System variable apply to all users on the system. The various Windows directories and the Java subsystem, plus others that should apply to all users, are set as part of the System path.

  2. You shouldn't do this because it may not be supported by all programs. Just specify the full paths as most programs expect, and you should be fine.

  3. There should be no XML in your %PATH% variables because the < and > characters, which are used extensively in XML, are invalid directory variables.

  4. Some old DOS programs may have trouble with this, but I haven't experienced any problems with spaces in path elements since Windows XP. Just make sure that every path you specify that includes spaces in directory names is enclosed within quotation marks. The document you referenced, that recommends this practice, appears to be outdated as it discusses Java v1.5 (Java v1.6 has been available for many years now, and Java v1.7 is anticipated by many to be released very soon).

    • Names are not always shortened to 8.3 with a ~1 suffix terminating the filename portion. For example, on 64-bit Windows you can type "Dir C:\PRO*" at a DOS prompt and you'll see at least two entries (typically "PROGRA~1" for "Program Files" and "PROGRA~2" for "Program Files (x86)").
Related Question