C# 获取windows系统版本信息
static void Main(string[] args)
{
Console.WriteLine(GetWindowsVer("Windows 10"));
}
static bool GetWindowsVer(string targetVer)
{
var reg = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion");
string productName = (string)reg.GetValue("ProductName");
return productName.StartsWith(targetVer);
}