The .NET Framework Overview: Accessing Environment Settings in C#
You can use the System.Environment class to obtain information about the machine and environment, as the following example demonstrates: using System; using System.Collections; class Test { public static void Main() { Console.WriteLine(“Command Line: {0}”, Environment.CommandLine); Console.WriteLine(“Current Directory: {0}”, Environment.CurrentDirectory); Console.WriteLine(“HasShutdownStarted: {0}”, Environment.HasShutdownStarted); Console.WriteLine(“Machine Name: {0}”, Environment.MachineName); Console.WriteLine(“OS Version: {0}”, Environment.OSVersion); Console.WriteLine(“ProcessorCount: {0}”, Environment.ProcessorCount); Console.WriteLine(“Stack Trace: [ [ ...]