(This snippet updates the Path variable specifically, but the logic can be extended to all variables).
If a new terminal window still shows the old variables, look at the parent application. Are you opening a terminal inside VS Code, ConEmu, or IntelliJ? You must restart that parent application. It is holding the stale environment block and passing it down to its children.
refreshenv
:: Refresh Machine Variables for /f "tokens=2*" %a in ('reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v Path') do set "Path=%b" :: Refresh User Variables for /f "tokens=2*" %a in ('reg query "HKCU\Environment" /v Path') do set "Path=%b" Use code with caution. Method 3: Restart the Parent Process (Explorer.exe)
How are you (GUI, setx , or PowerShell)?
After reloading, check with: