How to Get Operating System Information in C#


If you want to get Operating System information using C#, you can use System.Environment.OSVersion property as shown below:

Console.WriteLine(System.Environment.OSVersion.Platform); 
Console.WriteLine(System.Environment.OSVersion.ServicePack); 
Console.WriteLine(System.Environment.OSVersion.Version); 
Console.WriteLine(System.Environment.OSVersion.VersionString);

The output will be similar to the following depending on your operating system

Win32NT
Service Pack 3
5.1.2600.196608
Microsoft Windows NT 5.1.2600 Service Pack 3

 

 

About author


User avatar

Waqas Anwar

Founder of EzzyLearning.com, Senior Consultant, Microsoft .NET and Web Technologies

Comments