Xác Định Thông Tin Hệ Điều Hành Windows trong lập trình C#

Visual C# Code:
  1. using System;
  2.  
  3. class ChuongTrinh
  4. {
  5.     static void Main()
  6.     {
  7.         //Dong lenh de chay chuong trinh nay
  8.         Console.WriteLine("Command line : " + Environment.CommandLine);
  9.  
  10.         //Phien ban he dieu hanh
  11.         Console.WriteLine("OS PlatformID : " + Environment.OSVersion.Platform);
  12.         Console.WriteLine("OS Major Version : " + Environment.OSVersion.Version.Major);
  13.         Console.WriteLine("OS Minor Version : " + Environment.OSVersion.Version.Minor);
  14.         Console.WriteLine("CLR Version : " + Environment.Version);
  15.  
  16.         //Ten nguoi dung dang chay chuong trinh
  17.         Console.WriteLine("User Name : " + Environment.UserName);
  18.  
  19.         //User dang ky
  20.         Console.WriteLine("Domain Name : " + Environment.UserDomainName);
  21.  
  22.         //Ten may
  23.         Console.WriteLine("Machine name : " + Environment.MachineName);
  24.  
  25.         //Kiem tra ung dung la cua nguoi dung khong hay la dich vu
  26.         Console.WriteLine("Is interactive ? : " + Environment.UserInteractive);
  27.  
  28.         Console.WriteLine("Shutting down ? : " + Environment.HasShutdownStarted);
  29.  
  30.         //Thoi gian he dieu hanh da hoat dong (mili giay)
  31.         Console.WriteLine("Ticks since startup : " + Environment.TickCount);
  32.  
  33.         // Liet ke cac o dia co tren may
  34.         foreach (string s in Environment.GetLogicalDrives())
  35.         {
  36.             Console.WriteLine("Logical drive : " + s);
  37.         }
  38.  
  39.         // Cac thu muc chinh
  40.         Console.WriteLine("Current folder : " + Environment.CurrentDirectory);
  41.         Console.WriteLine("System folder : " + Environment.SystemDirectory);
  42.  
  43.         // Liet ke cac thu muc dac biet
  44.         foreach (Environment.SpecialFolder s in Enum.GetValues(typeof(Environment.SpecialFolder)))
  45.         {
  46.             Console.WriteLine("{0} folder : {1}", s, Environment.GetFolderPath(s));
  47.         }
  48.  
  49.         Console.ReadLine();
  50.     }
  51. }