Batch files to show the User/System environment variables stored in registry – via: Stack Overflow
Posted by jpluimers on 2016/09/20
I wrote two tiny batch files that would dump the environment variables from the registry.
Various reasons:
- Environment variables can be stored in two contexts: System and User (SET will show them all at once and for instance combine PATH up to 1920 characters).
- Environment variables can be set to auto-expand or not, which you cannot see from a SET command (REG_EXPAND_SZ versus REG_SZ).
show-user-environment-variables.bat:
reg query "HKCU\Environment"
show-system-environment-variables.bat:
reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
Filtered results:
User:
HKEY_CURRENT_USER\Environment Path REG_SZ D:\bin;C:\Windows\SysWOW64 TEMP REG_EXPAND_SZ %USERPROFILE%\AppData\Local\Temp TMP REG_EXPAND_SZ %USERPROFILE%\AppData\Local\TempSystem:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment NUMBER_OF_PROCESSORS REG_SZ 4 OS REG_SZ Windows_NT Path REG_SZ C:\Windows\Microsoft.NET\Framework\v1.1.4322\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\ PATHEXT REG_SZ .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC PROCESSOR_ARCHITECTURE REG_SZ AMD64 PROCESSOR_IDENTIFIER REG_SZ Intel64 Family 6 Model 58 Stepping 9, GenuineIntel PROCESSOR_LEVEL REG_SZ 6 PROCESSOR_REVISION REG_SZ 3a09 TEMP REG_EXPAND_SZ %SystemRoot%\TEMP TMP REG_EXPAND_SZ %SystemRoot%\TEMP USERNAME REG_SZ SYSTEM windir REG_EXPAND_SZ %SystemRoot%PATH, TEMP, TMP:
PATH=C:\Windows\Microsoft.NET\Framework\v1.1.4322\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\bin;C:\Windows\SysWOW64 TEMP=C:\Users\jeroenpluimers\AppData\Local\Temp TMP=C:\Users\jeroenpluimers\AppData\Local\Temp
–jeroen
via:






Leave a comment