Windows – Setting Windows PowerShell environment variables

powershellwindows

I have found out that setting the PATH environment variable affects only the old command prompt. PowerShell seems to have different environment settings. How do I change the environment variables for PowerShell (v1)?

Note:

I want to make my changes permanent, so I don't have to set it every time I run PowerShell. Does PowerShell have a profile file? Something like Bash profile on Unix?

Best Answer

If, some time during a PowerShell session, you need to append to the PATH environment variable temporarily, you can do it this way:

$env:Path += ";C:\Program Files\GnuWin32\bin"

If you need your path to be called before standard one, insert it at the beginning

$env:Path = "C:\Program Files\GnuWin32\bin;$env:Path"