Path from command prompt is different from Path in Environment Variables

Hong 1,246 Reputation points
2024-02-07T20:12:40.3066667+00:00

In Command Prompt, path command generates the following (I added new-lines to make it more readable):

PATH= C:\Program Files\Common Files\Oracle\Java\javapath; C:\Program Files\Java\jdk1.8.0_192; C:\Python38\Scripts; C:\Python38; C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin; C:\Windows\system32; C:\Windows; C:\Windows\System32\Wbem; C:\Windows\System32\WindowsPowerShell\v1.0; C:\Windows\System32\OpenSSH; C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit; C:\Program Files\dotnet; C:\Program Files\Microsoft SQL Server\130\Tools\Binn; C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn; C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn; C:\Program Files\Microsoft SQL Server\140\Tools\Binn;C:\Program Files\Microsoft SQL However, the window of Environment Variables shows the following: User's image

It does not have the following: C:\Program Files\Common Files\Oracle\Java\javapath; C:\Program Files\Java\jdk1.8.0_192; C:\Python38\Scripts; I think I deleted some of them with the Control Panel. Could anyone shed some light on this?

Windows for business Windows Client for IT Pros User experience Other
0 comments No comments
{count} votes

Accepted answer
  1. Michael Taylor 60,161 Reputation points
    2024-02-07T20:28:59.2333333+00:00

    The PATH variable for a console app is generated by taking first the PATH variable defined by SYSTEM. That is the bottom part of the screenshot you showed. Then it appends the PATH variable defined by the current user. That is what you're showing in your screenshot.

    On top of that it is possible to add additional values, either before or after, by editing the PATH variable in startup scripts that might run when the terminal is started.

    I should point out that system environment variable changes are not refreshed unless you reboot generally. That is because they are cached until not referenced anymore and therefore are probably still in use for most processes. User environment variable changes won't take effect on any current user process but new user processes should see the update. This can have a dramatic impact if you're changing variables for users that are running services as the services won't see the changes.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.