Why is my PATH environment variable different from the command prompt?
Windows has two classes of environment variables system environment variables and user environment variables. If you are using echo %PATH%
you will see your user environment variable PATH
. Only if there is no user variable defined, the system variable will be in effect for user processes.
The PATH
separator ;
should not be followed by a blank.
The following Microsoft note might be helpful:
You can modify user environment variables by editing the following Registry key:
HKEY_CURRENT_USER \
Environment
You can modify system environment variables by editing the following Registry key:
HKEY_LOCAL_MACHINE \
SYSTEM \
CurrentControlSet \
Control \
Session Manager \
Environment
Note that any environment variable that needs to be expanded (for example, when you use %SYSTEM%
) must be stored in the registry as a REG_EXPAND_SZ
registry value. Any values of type REG_SZ
will not be expanded when read from the registry.
Additional remark: Whenever a process changes its environment (rather than the registry settings which define the environment for new processes), the changes are only visible for child processes.