Detect windows operating system version

Operating System Version

The Version API Helper functions are used to determine the version of the operating system that is currently running. For more information, see Getting the System Version.

The following table summarizes the most recent operating system version numbers.

Operating system Version number
Windows 10 10.0*
Windows Server 2019 10.0*
Windows Server 2016 10.0*
Windows 8.1 6.3*
Windows Server 2012 R2 6.3*
Windows 8 6.2
Windows Server 2012 6.2
Windows 7 6.1
Windows Server 2008 R2 6.1
Windows Server 2008 6.0
Windows Vista 6.0
Windows Server 2003 R2 5.2
Windows Server 2003 5.2
Windows XP 64-Bit Edition 5.2
Windows XP 5.1
Windows 2000 5.0

* For applications that have been manifested for Windows 8.1 or Windows 10. Applications not manifested for Windows 8.1 or Windows 10 will return the Windows 8 OS version value (6.2). To manifest your applications for Windows 8.1 or Windows 10, refer to Targeting your application for Windows.

Identifying the current operating system is usually not the best way to determine whether a particular operating system feature is present. This is because the operating system may have had new features added in a redistributable DLL. Rather than using the Version API Helper functions to determine the operating system platform or version number, test for the presence of the feature itself.

To determine the best way to test for a feature, refer to the documentation for the feature of interest. The following list discusses some common techniques for feature detection:

  • You can test for the presence of the functions associated with a feature. To test for the presence of a function in a system DLL, call the LoadLibrary function to load the DLL. Then call the GetProcAddress function to determine whether the function of interest is present in the DLL. Use the pointer returned by GetProcAddress to call the function. Note that even if the function is present, it may be a stub that just returns an error code such as ERROR_CALL_NOT_IMPLEMENTED.
  • You can determine the presence of some features by using the GetSystemMetrics function. For example, you can detect multiple display monitors by calling GetSystemMetrics(SM_CMONITORS).
  • There are several versions of the redistributable DLLs that implement shell and common control features. For information about determining which versions are present on the system your application is running on, see the topic Shell and Common Controls Versions.

If you must require a particular operating system, be sure to use it as a minimum supported version, rather than design the test for the one operating system. This way, your detection code will continue to work on future versions of Windows.

Note that a 32-bit application can detect whether it is running under WOW64 by calling the IsWow64Process function. It can obtain additional processor information by calling the GetNativeSystemInfo function.

Which version of Windows operating system am I running?

Find operating system info in Windows 10

To find out which version of Windows your device is running, press the Windows logo key + R, type winver in the Open box, and then select OK.

Here’s how to learn more:

Select the Start button > Settings > System > About .

Under Device specifications > System type, see if you’re running a 32-bit or 64-bit version of Windows.

Under Windows specifications, check which edition and version of Windows your device is running.

If you’re having a problem with activation, see Activate in Windows 10.

If you forgot the password you use to sign in to Windows devices or email, see How to reset your Microsoft password.

For info about updating Windows, see Windows Update: FAQ.

Find operating system info in Windows 8.1 or Windows RT 8.1

To find out which version of Windows your device is running, press the Windows logo key + R, type winver in the Open box, and then select OK.

If your device is running Windows 8.1 or Windows RT 8.1, here’s how to learn more:

If you’re using a touch device, swipe in from the right edge of the screen, tap Settings, and then tap Change PC settings. Continue to step 3.

If you’re using a mouse, point to the lower-right corner of the screen, move the mouse pointer up, click Settings, and then click Change PC settings.

Select PC and devices > PC info.

Under Windows you’ll see which edition and version of Windows your device is running.

Under PC > System type you’ll see if you’re running a 32-bit or 64-bit version of Windows.

If you’re having a problem with activation, see Activate Windows 7 or Windows 8.1

If you forgot the password you use to sign in to Windows devices or email, see How to reset your Microsoft password.

For info about updating Windows, see Windows Update: FAQ.

Find operating system info in Windows 7

Select the Start button, type Computer in the search box, right-click on Computer, and then select Properties.

Under Windows edition, you’ll see the version and edition of Windows that your device is running.

Support for Windows 7 ended on January 14, 2020

We recommend you move to a Windows 10 PC to continue to receive security updates from Microsoft.

If you’re having a problem with activation, see Activate Windows 7 or Windows 8.1.

If you forgot the password you use to sign in to Windows devices or email, see How to reset your Microsoft password.

For info about updating Windows, see Windows Update: FAQ.

Determine whether your computer is running a 32-bit version or 64-bit version of the Windows operating system

Support for Office 2010 ended on October 13, 2020

Upgrade to Microsoft 365 to work anywhere from any device and continue to receive support.

When you install Microsoft Lync 2010 communications software, depending on your computer’s operating system you will need to choose between a 32-bit version or a 64-bit version installer.

The minimum operating system requirements for Lync 2010 is Window 7, Windows Vista, or Windows XP Professional with Service Pack 3 (SP3). For more information about system requirements, see Lync Online and Online Meeting Add-in for Microsoft Lync 2010 System Requirements.

Determine the operating system bit count

Windows 7 or Windows Vista

If you have Windows Vista or Windows 7, there are two methods to determine whether you are running a 32-bit or a 64-bit version. If one does not work, try the other.

Method 1: View System window in Control Panel

Click Start, type system in the search box, and then click System in the Control Panel list.

The operating system is displayed as follows:

For a 64-bit version operating system: 64-bit Operating System appears for the System type under System.

For a 32-bit version operating system: 32-bit Operating System appears for the System type under System.

Method 2: View System Information window

Click Start, type system in the search box, and then click System Information in the Programs list.

When System Summary is selected in the navigation pane, the operating system is displayed as follows:

For a 64-bit version operating system: X64-based PC appears for the System Type under Item.

For a 32-bit version operating system: X86-based PC appears for the System Type under Item.

Windows XP Professional

If you have Windows XP, there are two methods to determine whether you are running a 32-bit or a 64-bit version. If one does not work, try the other.

Method 1: View System Properties in Control Panel

Click Start, and then click Run.

Type sysdm.cpl, and then click OK.

Click the General tab. The operating system is displayed as follows:

For a 64-bit version operating system: Windows XP Professional x64 Edition Version appears under System.

For a 32-bit version operating system: Windows XP Professional Version appears under System.

Method 2: View System Information window

Click Start, and then click Run.

Type winmsd.exe, and then click OK.

When System Summary is selected in the navigation pane, locate Processor under Item in the details pane. Note the value.

If the value that corresponds to Processor starts with x86, the computer is running a 32-bit version of Windows.

If the value that corresponds to Processor starts with ia64 or AMD64, the computer is running a 64-bit version of Windows.

How to find the operating system version using JavaScript?

How can I find the OS name and OS version using JavaScript?

14 Answers 14

If you list all of window.navigator ‘s properties using

You’ll see something like this

Note that oscpu attribute gives you the Windows version. Also, you should know that:

I started to write a Script to read OS and browser version that can be tested on Fiddle. Feel free to use and extend.
Breaking Change:
Since September 2020 the new Edge gets detected. So ‘Microsoft Edge’ is the new version based on Chromium and the old Edge is now detected as ‘Microsoft Legacy Edge’!

@Ludwig ‘s solution was brilliant. A couple of fixes (which didn’t have to do with operating system, and I couldn’t place as a comment on his original posting because this is too long):

  1. IE 11 no longer identifies itself as MS IE.
  2. Chrome on IOS spoofs itself as Safari

JavaScript have access to the window.navigator.platform — a string representing the platform of the browser: https://developer.mozilla.org/en-US/docs/Web/API/NavigatorID/platform

Use it to extract whatever details you need (and can). Note that there are no guarantees that the client actually uses that platform since this can easily be modified in many ways.

platform.js seems like a good one file library to do this.

You can use this javascript function to check users’ OS simply

You can find the OS name and version in the navigator object, as others have answered. The standard, cross-browser place to find this information is in the navigator.userAgent property. However, user agent strings vary widely by OS and browser.

So, I created a script to encapsulate this logic and report on the most common OSes and browsers in a familiar way, like http://www.whatsmybrowser.org.

I open-sourced the script and uploaded it to github, https://github.com/keithws/browser-report. Pull requests are welcome!

I’ve created a library for parsing User Agent strings called Voodoo. But be aware that this should not be used instead of feature detection.

What Voodoo does, is that it parses the userAgent string, which is found in the Navigator object (window.navigator). It’s not all browsers that passes a reliable userAgent string, so even though it’s the normal way to do it, the userAgent can not always be trusted.

I fork @Ludwig code and remove necessity of swfobject .

I just use swfobject code for detect flash version.

I can’t comment on @Ian Ippolito answer (because I would have if I had the rep) but according to the document his comment linked, I’m fairly certain you can find the Chrome version for IOS. https://developer.chrome.com/multidevice/user-agent?hl=ja lists the UA as: Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/56.0.2924.75 Mobile/14E5239e Safari/602.1

So this should work:

Haven’t been able to test (otherwise I would have improved his answer) it to make sure since my iPad is at home and I’m at work, but I thought I’d put it out there.

Hey for a quick solution you can consider the following library : UAPARSER — https://www.npmjs.com/package/ua-parser-js

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!
  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

Sign up or log in

Sign up using Google

Sign up using Facebook

Sign up using Email and Password

Post as a guest

Required, but never shown

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Detect Windows version in .net

How can I detect the Windows OS versions in .net?

What code can I use?

15 Answers 15

System.Environment.OSVersion has the information you need for distinguishing most Windows OS major releases, but not all. It consists of three components which map to the following Windows versions:

For a library that allows you to get a more complete view of the exact release of Windows that the current execution environment is running in, check out this library.

Important note: if your executable assembly manifest doesn’t explicitly state that your exe assembly is compatible with Windows 8.1 and Windows 10.0, System.Environment.OSVersion will return Windows 8 version, which is 6.2, instead of 6.3 and 10.0! Source: here.

I used this when I had to determine various Microsoft Operating System versions:

I use the ManagementObjectSearcher of namespace System.Management

Do not forget to add the reference to the Assembly System.Management.dll and put the using: using System.Management;

Result:

Like R. Bemrose suggested, if you are doing Windows 7 specific features, you should look at the Windows® API Code Pack for Microsoft® .NET Framework.

It contains a CoreHelpers class that let you determine the OS you are currently on (XP and above only, its a requirement for .NET nowaday)

It also provide multiple helper methods. For example, suppose that you want to use the jump list of Windows 7, there is a class TaskbarManager that provide a property called IsPlatformSupported and it will return true if you are on Windows 7 and above.

You can use this helper class;

Sample code is here:

This is a relatively old question but I’ve recently had to solve this problem and didn’t see my solution posted anywhere.

The easiest (and simplest way in my opinion) is to just use a pinvoke call to RtlGetVersion

Where Major and Minor version numbers in this struct correspond to the values in the table of the accepted answer.

This returns the correct Windows version number unlike the deprecated GetVersion & GetVersionEx functions from kernel32

Via Environment.OSVersion which «Gets an System.OperatingSystem object that contains the current platform identifier and version number.»

These all seem like very complicated answers for a very simple function:

Detect OS Version:

Then simply do wrap a select case around the function.

  1. Add reference to Microsoft.VisualBasic .
  2. Include namespace using Microsoft.VisualBasic.Devices ;
  3. Use new ComputerInfo().OSFullName

The return value is «Microsoft Windows 10 Enterprise»

The above answers would give me Major version 6 on Windows 10.

The solution that I have found to work without adding extra VB libraries was following:

I wouldn’t consider this the best way to get the version, but the upside this is oneliner no extra libraries, and in my case checking if it contains «10» was good enough.

How about using a Registry to get the name.

«HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion» has a value ProductName since Windows XP.

If you are using .NET Framework 4.0 or above. You can remove the Is64BitOperatingSystem() method and use Environment.Is64BitOperatingSystem.

First solution

To make sure you get the right version with Environment.OSVersion you should add an app.manifest using Visual Studio and uncomment following supportedOS tags:

Then in your code you can use Environment.OSVersion like this:

Example

For instance in my machine ( Windows 10.0 Build 18362.476 ) result would be like this which is incorrect:

By adding app.manifest and uncomment those tags I will get the right version number:

Alternative solution

If you don’t like adding app.manifest to your project, you can use OSDescription which is available since .NET Framework 4.7.1 and .NET Core 1.0.

Note: Don’t forget to add following using statement at top of your file.

You can read more about it and supported platforms here.

Читайте также:  Юторрент для windows 10
Оцените статью