Displays the machine information and logical drives of a machine in C#.net

How to Displays the machine information and logical drives of a machine in C#.net

using System;
class EnvironmentClass
{
static void Main(string[] args)
{
//Getting machine and user information
Console.WriteLine("Machine Information");
Console.WriteLine("======================");
Console.WriteLine("Machine Name: "+ Environment.MachineName);
Console.WriteLine("OS Version: "+ Environment.OSVersion);
Console.WriteLine("System Directory: "+ Environment.SystemDirectory);
Console.WriteLine("User Name: "+ Environment.UserName);
Console.WriteLine("Version: "+ Environment.Version);
Console.WriteLine("Current Directory: "+ Environment.CurrentDirectory);
Console.WriteLine();
// Get all logical hard drives
string[] drives = Environment.GetLogicalDrives();
Console.WriteLine("======================");
Console.WriteLine("Available drives:");
foreach(string drive in drives)
Console.WriteLine(drive);
Console.ReadLine();
}
}
By Kalit Sikka   Popularity  (1432 Views)