maphew

Refreshenv

February 18, 2024

RefreshEnv.cmd

From Chocolatey project. In a CMD shell, it queries the registry for default environment variables and applies them to the current session. Handy when installing something that adds a directory to PATH and you don't want to start a new shell to take advantage of it.

https://github.com/chocolatey/choco/blob/develop/src/chocolatey.resources/redirects/RefreshEnv.cmd

Refreshes the environment variables in the current PowerShell session:

Install-Script -Name Refresh-EnvironmentVariables

From < https://www.powershellgallery.com/packages/Refresh-EnvironmentVariables, https://github.com/asheroto/Refresh-EnvironmentVariables>

Also see Refresh powershell without restarting - https://github.com/maphew/mhwcode/blob/master/other/psh/Update-SessionEnvironment.ps1 

 

# Open profile script in Notepad (if it doesn't exist, create it)
notepad $PROFILE

# Reload the profile script to apply changes
. $PROFILE

From < https://chatgpt.com/c/a5102997-d999-4153-a609-cc703471759d>