This could be a simple question, but I couldn’t find a proper answer.
How do you update the environment variables from within a current Windows PowerShell session without closing the current one?
Up to now, when I modify for example the PATH environment variable from Control Panel > System, I have to close current session and open a new one, so that variables are refreshed, or issue a SetEnviromentVariable which is cumbersome.
I’m coming from the Linux world, so I’m looking for something like source command.
The environment gets populated on process start-up which is why you’ll need to restart the process.
You can update the environment by reading it from the registry. Maybe with a script like the following:
(untested)