System | Found in the registry under HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment |
User | Found in the registry under HKCU\Environment |
Volatile | Found in the registry under HKCU\Volatile Environment |
Process | The value of process variables is stored «within» the process and only for the duration of the process. |
GetEnvironmentVariable()
and GetEnvironmentVariables
in the .NET class System.Environment
. System.Collections.Hashtable
(see also hash tables in PowerShell): PS C:\> [System.Environment]::GetEnvironmentVariables() Name Value ---- ----- SESSIONNAME Console ProgramFiles(x86) C:\Program Files (x86) USERDNSDOMAIN TQ84.LOCAL …
GetEnvironmentVariable(varName)
, again in PowerShell: PS C:\> [System.Environment]::GetEnvironmentVariable('SystemDrive') C:
USER_VAR
with the value foo
and a system wide (global) variable GLOBAL_VAR
with the value bar
: [environment]::setEnvironmentVariable('USER_VAR' , 'foo', 'user' ) [environment]::setEnvironmentVariable('GLOBAL_VAR', 'bar', 'machine')
[environment]::setEnvironmentVariable('PROC_VAR' , 'baz', 'process')
cmd.exe
), this tab can be opened like so: control sysdm.cpl,,3
control 'sysdm.cpl,,3'
Variable | Possible value | registry | |
ALLUSERSPROFILE | C:\ProgramData | Set by wininit.exe , same value as %ProgramData% (at least on Windows 10) | |
APPDATA | C:\Users\Rene\AppData\Roaming | HKCU\Volatile Environment | |
CLIENTNAME | HKCU\Volatile Environment\n | ||
CommonProgramFiles | C:\Program Files\Common Files | ||
CommonProgramFiles(x86) | C:\Program Files (x86)\Common Files | ||
CommonProgramW6432 | C:\Program Files\Common Files | ||
COMPUTERNAME | DESKTOP-HELLO | ||
ComSpec | C:\Windows\system32\cmd.exe | HKLM\…SessMgr\Env… | |
DriverData | C:\Windows\System32\Drivers\DriverData | HKLM\…SessMgr\Env… | |
FPS_BROWSER_APP_PROFILE_STRING | Internet Explorer | ||
FPS_BROWSER_USER_PROFILE_STRING | Default | ||
HOMEDRIVE | C: | The combination of HOMEDRIVE and HOMEPATH points to a location where personal files should be stored. It might, but needs not to, be the same directory as %USERPROFILE% . | HKCU\Volatile Environment |
HOMEPATH | \Users\Rene | Rene corresponds to %USERNAME% . Compare with %USERPROFILE% | HKCU\Volatile Environment |
HOMESHARE | \\alpha.foo\some\path | If HOMEDRIVE is on a UNC path, HOMESHARE contains the its UNC path | HKCU\Volatile Environment |
LOCALAPPDATA | C:\Users\Rene\AppData\Local | HKCU\Volatile Environment | |
LOGONSERVER | \\DESKTOP-HELLO | HKCU\Volatile Environment | |
NUMBER_OF_PROCESSORS | 2 | HKLM\…SessMgr\Env… | |
OneDrive | C:\Users\Rene\OneDrive | See also OneDrive | HKCU\Environment |
OS | Windows_NT | HKLM\…SessMgr\Env… | |
PATH | … | … | … |
PATHEXT | .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC | HKLM\…SessMgr\Env… | |
PROCESSOR_ARCHITECTURE | AMD64 | HKLM\…SessMgr\Env… | |
PROCESSOR_IDENTIFIER | AMD64 Family 21 Model 16 Stepping 1, AuthenticAMD | HKLM\…SessMgr\Env… | |
PROCESSOR_LEVEL | 21 | HKLM\…SessMgr\Env… | |
PROCESSOR_REVISION | 1001 | HKLM\…SessMgr\Env… | |
ProgramData | C:\ProgramData | Set by wininit.exe , same value as %ALLUSERSPROFILE (at least on Windows 10) | |
ProgramFiles | C:\Program Files | ||
ProgramFiles(x86) | C:\Program Files (x86) | ||
ProgramW6432 | C:\Program Files | ||
PUBLIC | C:\Users\Public | Set by wininit.exe | |
SESSIONNAME | Console | HKCU\Volatile Environment\n | |
SystemDrive | C: | ||
SystemRoot | C:\Windows | ||
TEMP | C:\Users\Rene\AppData\Local\Temp | HKCU\Environment overwrites HKLM\…SessMgr\Env… | |
TMP | C:\Users\Rene\AppData\Local\Temp | HKCU\Environment overwrites HKLM\…SessMgr\Env… | |
USERDOMAIN | DESKTOP-HELLO | HKCU\Volatile Environment | |
USERDOMAIN_ROAMINGPROFILE | DESKTOP-HELLO | HKCU\Volatile Environment | |
USERNAME | Rene | HKCU\Volatile Environment overwrites HKLM\…SessMgr\Env… . | |
USERPROFILE | C:\Users\Rene | Compare with %HOMEDRIVE%%HOMEPATH% | HKCU\Volatile Environment |
windir | C:\Windows |
__COMPAT_LAYER | Setting __COMPAT_LAYER to RunAsInvoker prevents elevation and thus also suppresses UAC prompts. |
$env:PSModulePath
is used by PowerShell to locate modules and consists of the following default paths $env:PSModulePath
points, the import-module
cmdlet must be used. paths.ps1
is a PowerShell script that prints the individual components of the PATH environment variable to the console. msinfo32.exe
.