Skip to content

How to update the session environment on Windows runner? #6065

Discussion options

You must be logged in to vote

I found the solution. To use Chocolatey's refreshenv/Update-SesionEnvironment in Powershell (PS) you have to import their helpers package to your PS.

Import-Module "$env:ChocolateyInstall/helpers/chocolateyInstaller.psm1"
refreshenv

The Chocolatey install instructions that I found do not mention the helpers. I do not know if having to import them is standard operating procedure.

Although the runner creates a new PS for each step, those processes do not see the registry updates which means they must be launched from an existing PS instance and not the system. Therefore you need to add the above to any step that needs the environment variables.

If you are using Java you also have to be awa…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@MarkCallow
Comment options

Comment options

You must be logged in to vote
1 reply
@gep13
Comment options

Answer selected by MarkCallow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants