Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I display environment variables in PowerShell, and be able to distinguish between which ones are "user" vars and which ones are "system" vars?

share|improve this question

Not a powershell pro, but at worst, you could go fish around in the registry to see whether the vars you're interested in are showing up there. Inside a given session, I'm not really sure there's any distinction between user/sys vars other than the registry storage location...

Pertinent keys are:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
share|improve this answer
Correct: in process there is no distinction. And of course PATH is a combination of system and user settings so as set is neither. – Richard Apr 6 '11 at 8:06

To find out within PowerShell:

Get-ItemProperty -Path 'Registry::HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'

Get-ItemProperty -Path 'Registry::HKCU\Environment'
share|improve this answer

Since PowerShell has access to the .NET Framework, you could use

[System.Environment]::GetEnvironmentVariables([System.EnvironmentVariableTarget]::Machine) [System.Environment]::GetEnvironmentVariables([System.EnvironmentVariableTarget]::Process) [System.Environment]::GetEnvironmentVariables([System.EnvironmentVariableTarget]::User)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.