Let's say we are in a CMD or Powershell terminal, or simply inside VS Code Terminal.
Then, we make a change in Windows Path in the sysdm.cpl utility and we add a new path to a newly installed executable in the system PATH variable.
However, this new executable is not recognized in the current terminals or inside VS Code (closing and reopening terminal in VS Code doesn't help).
In Linux, after making change to PATH, we could simply run source ~/.bash_profile
, assuming PATH was modified inside .bash_profile
.
Is there an equivalent to this source
on Windows so that we could re-evaluate PATH
without closing the terminal window completely and re-opening it?
Asked
Active
Viewed 18 times
1

Mehdi Haghgoo
- 3,144
- 7
- 46
- 91
-
The linked duplicate describes how to refresh a just-updated persistent definition of the `Path` environment variable in-session. (That doesn't require or involve reloading of the `$PROFILE` file, however, which - if needed - you'd do with `. $PROFILE`). – mklement0 Feb 07 '23 at 13:25
-
Actually, the answers for that question tell how to add an entry to the path manually. But, I need to reload the path from last values set in the sysdm.cpl utility. – Mehdi Haghgoo Feb 07 '23 at 13:30
-
Look at [this answer](https://stackoverflow.com/a/71415530/45375) to the linked diplicate. – mklement0 Feb 07 '23 at 13:57
-
To spell it out: persistent environment variables defined via the `sysdm.cpl` Control Panel applet are stored in the registry, and that's where the linked answer loads them from, via a .NET API. – mklement0 Feb 07 '23 at 14:37