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!

  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)").
  1. User variables exist just whilst your user is running and is only accessible to processes that run under the context of your user. System variables on the other hand are accessible by everyone to every user.

  2. (I was not 100% certain when I first wrote, but I have just tested this for you and redone this answer!). Variables are accessed at the time they are called. I have done the following test:

    set testing=c:\test
    set path=%testing%
    > PATH=c:\test

I have also recreated your steps by making an environmental variable called testing then set my path to %testing%. I went to the command prompt again and when I typed path, I got the same


So, it looks like this should work fine. On further examination, this is what Microsoft and other vendors seem to do - there are many cases of %systemroot% defined in the path with that variable defined elsewhere.

3. There is no easy way, Path is a old DOS command that exists for the purpose of running executables and commands when out of folder. Whilst not very helpful if you want command line access, try taking a look at a tool such as Everything that can make files very easy to get to!

4. All I can really do is repeat @Randolf Richardson's answer... 6 characters + ~1 (increase by one for each folder) and try to put names with spaces in quotation marks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.