How To Get More Enviroment Information

To access to all of the enviroment information you can call:

Environment.GetEnvironmentVariables()

 On my machine it brings back the following:

    [“Cor_Debugging_Control_424242”]: “1”
    [“SESSIONNAME”]: “Console”
    [“LIB”]: @”C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Lib\”
    [“TEMP”]: @”C:\WINDOWS\Temp”
    [“PROCESSOR_ARCHITECTURE”]: “x86”
    [“HOMEPATH”]: @”\Documents and Settings\dmccart”
    [“USERDOMAIN”]: “MYMAIN”
    [“PATHEXT”]: “.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH”
    [“USERNAME”]: “dmccart”
    [“ALLUSERSPROFILE”]: @”C:\Documents and Settings\All Users”
    [“SMS_LOCAL_DIR”]: @”C:\WINDOWS”
    [“windir”]: @”C:\WINDOWS”
    [“SystemRoot”]: @”C:\WINDOWS”
    [“OS”]: “Windows_NT”
    [“PROCESSOR_LEVEL”]: “15”
    [“COMPUTERNAME”]: “DMCCART”
    [“HOMEDRIVE”]: “C:”
    [“PROCESSOR_IDENTIFIER”]: “x86 Family 15 Model 2 Stepping 9, GenuineIntel”
    [“ComSpec”]: @”C:\WINDOWS\system32\cmd.exe”
    [“APPDATA”]: @”C:\Documents and Settings\dmccart\Application Data”
    [“TMP”]: @”C:\WINDOWS\Temp”
    [“CommonProgramFiles”]: @”C:\Program Files\Common Files”
    [“NUMBER_OF_PROCESSORS”]: “1”
    [“ProgramFiles”]: @”C:\Program Files”
    [“PROCESSOR_REVISION”]: “0209”
    [“VS71COMNTOOLS”]: @”C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\”
    [“LOGONSERVER”]: @”\\MYDC1″
    [“SMS_LOCAL_DIR_USER”]: @”C:\WINDOWS”
    [“Path”]: @”C:\WINDOWS\system32;C:\WINDOWS;C:\Utils;”
    [“INCLUDE”]: @”C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\include\”
    [“USERPROFILE”]: @”C:\Documents and Settings\dmccart”
    [“SystemDrive”]: “C:”

If you want to access one of these values simple use:

Environment.GetEnvironmentVariable("USERDOMAIN")

 

Tip By: David McCarter


Discover more from dotNetTips.com

Subscribe to get the latest posts sent to your email.

Leave a comment

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