首页 > 编程语言 >javascript: get Operating System version

javascript: get Operating System version

时间:2022-10-02 15:23:49浏览次数:69  
标签:10 Windows javascript System Write Version Operating os Response

javascript:

<script type="text/ecmascript">
console.log(navigator.userAgent)
console.log(navigator.appVersion)
console.log(navigator.platform)	
//Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.53
//5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.53
//Win32
navigator.userAgentData.getHighEntropyValues(['platformVersion'])
.then(uapv => { console.log(uapv.platformVersion); });	
//10.0.0	
</script>	

 java: 

            System.out.println("OS Name: " + System.getProperty("os.name"));
            System.out.println("OS Version: " + System.getProperty("os.version"));
//OS Name: Windows 10
//OS Version: 10.0

  

C#

 Response.Write(Environment.OSVersion.Version.Build.ToString());




    }
    /// <summary>
    /// 是否WIN11
    /// </summary>
    /// <returns></returns>
    public static bool IsWindows11()
    {
        var reg = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion");

        var currentBuildStr = (string)reg.GetValue("CurrentBuild");
        var currentBuild = int.Parse(currentBuildStr);

        if(Environment.OSVersion.Version.Build>=2200)
        {
            int ver = 11;
        }

        using (var objOS = new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem"))
        {
            foreach (ManagementObject objMgmt in objOS.Get())
            {
                Console.WriteLine("{0}: {1}", objMgmt.Properties["Caption"].Name, objMgmt.Properties["Caption"].Value);
            }
        }


        return currentBuild >= 22000;
    }

  

Windows Version Sec-CH-UA-Platform-Version
Windows 7 | 8 | 8.1 0.0.0
Windows 10 1507 1.0.0
Windows 10 1511 2.0.0
Windows 10 1607 3.0.0
Windows 10 1703 4.0.0
Windows 10 1709 5.0.0
Windows 10 1803 6.0.0
Windows 10 1809 7.0.0
Windows 10 1903 | 1909 8.0.0
Windows 10 2004 | 20H2 | 21H1 10.0.0
Windows 11 Previews 13.0.0 | 14.0.0
Windows 11 Release 15.0.0

 

https://bestiejs.github.io/platform.js/
https://www.npmjs.com/package/platform
https://github.com/bestiejs/platform.js
https://textslashplain.com/2021/09/21/determining-os-platform-version/
https://angularfixing.com/how-to-get-os-version-name-on-mobile-tablet-or-pc-in-angular-project/
https://github.com/becher/angular-device-information
https://www.codeproject.com/Articles/5336372/Windows-11-Version-Detection
https://www.anoopcnair.com/windows-10-build-numbers-version-numbers/
https://learn.microsoft.com/en-us/windows/release-health/windows11-release-information

 

        Response.Write(Environment.OSVersion.Version.Build.ToString());

        Response.Write("Operating System Detaiils");

        OperatingSystem os = Environment.OSVersion;

        Response.Write("OS Version: " + os.Version.ToString());

        Response.Write("OS Platoform: " + os.Platform.ToString());

        Response.Write("OS SP: " + os.ServicePack.ToString());

        Response.Write("OS Version String: " + os.VersionString.ToString());

        Response.Write("<br/>");



        // Get Version details

        Version ver = os.Version;

        Response.Write("Major version: " + ver.Major);

        Response.Write("Major Revision: " + ver.MajorRevision);

        Response.Write("Minor version: " + ver.Minor);

        Response.Write("Minor Revision: " + ver.MinorRevision);

        Response.Write("Build: " + ver.Build);

  

标签:10,Windows,javascript,System,Write,Version,Operating,os,Response
From: https://www.cnblogs.com/geovindu/p/16748812.html

相关文章