My Windows 7 PATH variable shows different content weather I enter the PATH
command in the command prompt or weather I go through the environment variables dialog box. More over, the PATH
variable seems to be duplicated at some time.
PATH variable @ the command prompt:
1 C:\soft\Python27\;
2 C:\soft\Python27\Scripts;
3 C:\ProgramData\Oracle\Java\javapath;
4 C:\Windows\system32;
5 C:\Windows;
6 C:\Windows\System32\Wbem;
7 C:\Windows\System32\WindowsPowerShell\v1.0\;
8 C:\Anaconda;
9 C:\Anaconda\Scripts;
10 C:\Program Files\Java\jdk1.8.0_65\bin;
11 C:\Program Files (x86)\Skype\Phone\;
12 C:\Program Files\MATLAB\R2014a\runtime\win64;
13 C:\Program Files\MATLAB\R2014a\bin;
14 C:\Program Files\MATLAB\R2014a\polyspace\bin;
15 C:\soft\Python27\;
16 C:\soft\Python27\Scripts;
17 C:\ProgramData\Oracle\Java\javapath;
18 C:\Windows\system32;
19 C:\Windows;
20 C:\Windows\System32\Wbem;
21 C:\Windows\System32\WindowsPowerShell\v1.0\;
22 C:\Anaconda;
23 C:\Anaconda\Scripts;
24 C:\Program Files\Java\jdk1.8.0_65\bin;
25 C:\Program Files (x86)\Skype\Phone\;
26 C:\Program Files\MATLAB\R2014a\runtime\win64;
27 C:\Program Files\MATLAB\R2014a\bin;
28 C:\Program Files\MATLAB\R2014a\polyspace\bin;
29 K:\sw\Git\cmd;
PATH variable @ through the environment variables dialog box
1 C:\soft\Python27\;
2 C:\soft\Python27\Scripts;
3 C:\ProgramData\Oracle\Java\javapath;
4 C:\Windows\system32;
5 C:\Windows;
6 C:\Windows\System32\Wbem;
7 C:\Windows\System32\WindowsPowerShell\v1.0\;
8 C:\Anaconda;
9 C:\Anaconda\Scripts;
10 C:\Program Files\Java\jdk1.8.0_65\bin;
11 C:\Program Files (x86)\Skype\Phone\;
12 C:\Program Files\MATLAB\R2014a\runtime\win64;
13 C:\Program Files\MATLAB\R2014a\bin;
14 C:\Program Files\MATLAB\R2014a\polyspace\bin;
15 K:\sw\Git\cmd;
At the command prompt, the first 14 entries are duplicated.
Question: how can I fix this?
Best Answer
There are two sets of environment variables: user and system:
The system variables are the same for all users on the machine, and require Administrator privilege to change. The user variables are individual to each user, and can be altered freely by the user.
For most variables, if there are a system variable and a user variable with the same name, the user variable simply overrides the system one. But
PATH
is a special case — the value of the variable that is set in CMD is the user variable appended to (the end of) the system variable (with a semicolon (;
) interjected, if necessary).It looks like you made a common error — you copied your complete
PATH
value into the space for your individualPATH
variable in the environment variables dialog box. (Or perhaps some buggy program did this for you.) This resulted in the systemPATH
value being duplicated in your individualPATH
variable, so now you get the combined / duplicated value whenever you start a Command Prompt process. The solution is simply to edit your individualPATH
variable to remove the first 14 entries (i.e., everything butK:\sw\Git\cmd
). Those 14 directory names are in the systemPATH
value, so you will still get them in yourPATH
value (but only once).