Posted on Leave a comment

Add variable to PATH inside windows container – reload env variables

In a previous article I explained how you can add python on PATH when you install it on a windows container image.

However if you try to use the python verb immediately you may face a problem that variable is not recognized.

In order to resolve this issue you will have to reload the environmental variables so that change reflects the current powershell session that you use.

By performing the below powershell command you can reload env variables and continue the execution of your scripts with variables reloaded.

$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")