Determine Operating System Windows

  1. How To Find Operating System On Computer
  2. Free Windows Operating System Downloads
Active1 year, 7 months ago

I have an app I created for Windows: PC/Tablet 8.1, Mobile/Phone 8.1 and UWP 10.

It is a WinRT app using C#.

To place an advertising banner in the app, it is required to make a separate ad unit ID for each operating system.

Aug 03, 2018  Finally, if you are in front of the computer, you can usually determine what operating system is being run on the computer by rebooting the computer. As the computer boots, it will indicate the operating system as it starts.

Operating

Is there a way to determine which operating system is currently being used?

It is possible to check which device is being used by using the code:

But how to know if the operating system is Windows 8.1 or Windows 10?

UPDATE:

How To Find Operating System On Computer

I have come across an interesting article about getting the OS version for C#/XAML:

It uses System.Type.GetType to check if Windows.System.Profile.AnalyticsVersionInfo returns null.

I modified and tested the code, and it seems to work in the Visual Studio emulators and simulator. I can't test for a Windows 8.1 computer since I'm using a Windows 10 computer, but for the Windows Phone 8.1 and Windows 10 Mobile, it was accurate. I haven't tested it on actual phone devices.

So it seems that checking for the type of AnalyticsVersionInfo that is only available in Windows 10 will return true or false depending on the OS.

So would the following code be recommended to use in a release version?

UPDATE:

Free Windows Operating System Downloads

One-liner:

shoelzer
9,8752 gold badges24 silver badges45 bronze badges
theMaxxtheMaxx
7561 gold badge11 silver badges25 bronze badges

2 Answers

Try with this, i found it at https://msdn.microsoft.com/en-us/library/system.environment.osversion(v=vs.110).aspx

Alfredo SolerAlfredo Soler

You could just check if a class that was only added in Windows 10 exists on the system.

SuniusSunius

Not the answer you're looking for? Browse other questions tagged c#windows-runtimeoperating-system or ask your own question.