Does $Env:Path concatenate System and User Path variables?

I was recently parsing my computer’s Path variable using Powershell (to check the order of its directories), and noticed that its last few directories were missing from the system Path variable (which I checked separately under ‘Advanced System Settings’ in the Control Panel). Upon closer inspection, I noticed that these missing directories were actually contained in the user Path variable. This led me to believe that Powershell concatenates the system and user Path variables when displaying them using $Env:Path (or when viewing the environment variables’ directory).

Why doesn’t Powershell display these environment variables separately? I understand that they both have the same name, but shouldn’t that create some kind of aliasing conflict/override rather than concatenating the two aliases?

On a related note, I also noticed that $Env:TEMP has two distinct definitions – one for the system and one for the user. But when I echo this variable in Powershell, the user alias is returned without the content of the system alias (i.e. no concatenation of the two). Why does TEMP behave differently to Path in this way?

Thanks in advance for any help!

submitted by /u/HemiDemiSemiYetti
[link] [comments]

Leave a Reply