C# Get environment info

By admin - Last updated: Monday, March 1, 2004 - Save & Share - Leave a Comment
using System;
public static void GetEnvironmentInfo()
{
    Console.WriteLine("CurrentDirectory: {0}", Environment.CurrentDirectory);
    Console.WriteLine("MachineName: {0}", Environment.MachineName);
    Console.WriteLine("OSVersion: {0}", Environment.OSVersion.ToString());
    Console.WriteLine("SystemDirectory: {0}", Environment.SystemDirectory);
    Console.WriteLine("UserDomainName: {0}", Environment.UserDomainName);
    Console.WriteLine("UserInteractive: {0}", Environment.UserInteractive);
    Console.WriteLine("UserName: {0}", Environment.UserName);
    Console.WriteLine("CLRVersion: {0}", Environment.Version.ToString());
    Console.WriteLine("WorkingSet: {0}", Environment.WorkingSet);
    Console.WriteLine("ExpandEnvironmentVariables: {0}",
        Environment.ExpandEnvironmentVariables("System drive: " +
        "%SystemDrive% System root: %SystemRoot%"));
    Console.WriteLine("GetLogicalDrives: {0}", String.Join(", ",
                      Environment.GetLogicalDrives()));
}



Posted in Code Notes • • Top Of Page