I\'m looking for a means to detect if my C# app is running on Windows 10.
I had hoped that Environment.OSVersion
would do the trick, but this seems to r
If you look at registry you will found environment name:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName
For example my product name is Windows 10 Home
:
With this code you get if it 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");
}
Note: Add using Microsoft.Win32;
to your usings.