ANTICHAT

ANTICHAT (https://forum.antichat.xyz/index.php)
-   С/С++, C#, Rust, Swift, Go, Java, Perl, Ruby (https://forum.antichat.xyz/forumdisplay.php?f=24)
-   -   Узнаём Windows версию с помощью WMI (https://forum.antichat.xyz/showthread.php?t=768253)

kick 31.03.2017 23:01

Код:


Код:

public static string GetWindowsVersion()
  {
    string sWindowsVersion = "";
    string sQuery = "SELECT * FROM Win32_OperatingSystem";
    ManagementObjectSearcher oManagementObjectSearcher = new ManagementObjectSearcher(sQuery);
    foreach (ManagementObject oManagementObject in oManagementObjectSearcher.Get())
    {
    sWindowsVersion = string.Format("{0}| {1}", (string)oManagementObject["Caption"], (string)oManagementObject["OSArchitecture"]);
    }
    return (sWindowsVersion);
  }



Время: 02:54