I Use C#. I try to get the current version of the OS:
OperatingSystem os = Environment.OSVersion;
Version ver = os.Version;
I get on the Windows 10: 6.2.
But 6.2 is Windows 8 or WindowsServer 2012 (Detect Windows version in .net)
I found the following solution (How can I detect if my app is running on Windows 10).
static bool IsWindows10()
{
var reg = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion");
string productName = (string)reg.GetValue("ProductName");
return productName.StartsWith("Windows 10");
}
This is the best way to get the current version in C#?
Add application manifest to your application and add the supportedOS Id of Windows 8.1 and Windows 10 to the manifest:
Now
Environment.OSVersion
includes the correct data for Windows 8.1 and Windows 10 and not 6.2 to indicate you run Windows 8. This is a change since Windows 8.1.Here is a link from Microsoft offical, indicating how to get the System Version. It actually is a call to the Version API Helper Functions
So basically you must convert this code into C# because it's in C++, then keep only the Windows 10 part...
And if you like trying to read code, you can check out this one link. This DLL can be used to get information on the OS...