Why are changes to my PATH not being recognised?
Solution 1:
When you start a new process (such as a new command line), it will pick up the environment variables from the process that is starting it. When the path is updated, only the process performing the update can know it has changed, and the setting doesn't propagate until you log back on (for per-user settings) or reboot (for system-wide settings)
Solution 2:
As Rowland suggests, when starting a new process, it will read the environment variables from the process that is starting it. Therefore, when starting a command-prompt from the Start Menu or the Desktop, it reads the environment variables from explorer.exe
which, as grawity suggests, detects changes to environment settings in the registry and thus I see my new PATH in command-prompts started from the Desktop or Start Menu.
The reason I do not see updates to my PATH in the screencast I posted is because I had initially launched an explorer window using FARR making FindAndRunRobot.exe
the parent process. FARR doesn't automatically detect environment changes and so, child processes spawned from it do not pick up the new PATH. I also had 'Launch folder windows in a separate process' option set in Explorer which means that all explorer.exe windows I opened subsequent to the initial one opened by FARR where also children of FARR.
By turning-off the 'Launch folder windows in a separate process' option, new explorer.exe
processes aren't created under FARR, which solves my problem. However, I also launch console windows and other things directly from FARR; these also get the old environment settings. If I restart FARR, then the new environment settings are propagated.
Here's a screenshot of Process Explorer showing processes spawned from FARR. None of these processes receive the new environment settings from the top-level explorer.exe
unless I restart FARR: