views:

2554

answers:

1

I'm having this weird situation :

My user's and system's PATH variable is different than the PATH in powershell.

When I do :

PS C:\$env:path
C:\Windows\System32\WindowsPowerShell\v1.0\;c:\oldpath

However this is not correct, it looks like it stuck on some old PATH variable of my system, so none of the udpates I've done on it didn't change this variable (I do restart after every change to test).

Why is this happening? Do I have to set a PATH variable just for powershell?

+7  A: 

Powershell will inherit the environment of the process that launched it (which depends on how you launch it). This is usually the interactive shell (explorer.exe). When you modify the environment from computer properties, you modify the environment of explorer.exe, so if you launch powershell from explorer.exe, (for example from the start menu) you should see the new environment.

However, if you launch it from something else (say a cmd.exe shell that you already had opened), then you won't since that process was launched under the old environment.

The sure fire way of seeing all environment changes is to log off and log back on. Otherwise, just be careful how you are launching things.

zdan
this is interesting, I've launched it from "Launchy", I don't have access the system right now. Will give it another shot on monday see if that was the problem or not.
dr. evil
Ooh...great call zdan. I wasn't even thinking of launching it any other way than explorer. Bet this is it.
EBGreen
Yeah, I've seen similar behavior with SlickRun. Instead of logging off, I kill explorer.exe (and slickrun.exe), reopen Explorer, then try again.
Peter Seale
I use launchy too. Just restarting launchy should work.
zdan
Hahaha... had the same problem here with launchy :\
Mark