Example

using System;
using System.Collections;
namespace Samples
{
  public class EnvironmentSample
  {
    public static void Main()
    {
      Console.WriteLine("Command line: {0}",
                        Environment.CommandLine);
      Console.WriteLine("CLR Version: {0}",
                        Environment.Version);
      string[] a = Environment.GetCommandLineArgs();
      foreach(string s in a)
        Console.WriteLine("Command Line Argument: {0}", s);
      IDictionary d = Environment.GetEnvironmentVariables();
      IDictionaryEnumerator e = d.GetEnumerator();
      while(e.MoveNext())
        Console.WriteLine("Key: {0} Value: {1}",
                          e.Key, e.Value);
    }
  }
}
The output is
 Command line: Environment CLR Version: 1.0.3705.288 Command Line Argument: Environment Key: SystemDrive Value: C: Key: USERPROFILE Value: C:\Documents and Settings\damien Key: INCLUDE ...

Get .NET Framework Standard Library Annotated Reference, Volume 1: Base Class Library and Extended Numerics Library now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.