The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,676 other followers

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:

  1. 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).
  2. 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\Temp

System:

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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

 
%d bloggers like this: