Get windows version name

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.

Читайте также:  Архиватор exe для windows

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.

Find windows OS version from command line

Windows has command line utilities that show us the version of the Windows OS running on the computer, including the service pack number. There are multiple CMD commands that help with finding this, you can pick the one that suits your need. Ver command can show you the OS version whereas Systeminfo command can additionally give you service pack, OS edition and build number etc.

Find OS Version and Service Pack number from CMD

As you can see above, ver command shows only OS version but not the service pack number. We can find service pack number as well with Systeminfo command. Systeminfo dumps lot of other information too, which we can filter out using findstr command.

This command works on XP, Vista and Windows 7 and on Server editions also. Find below example for Win7.

In case of Windows 7 SP1, the output would be slightly different as below.

If you want to print more details, then you can use just ‘OS’ in the findstr search pattern. See example below for Server 2008.

Check Windows version using WMIC command

Run the below WMIC command to get OS version and the service pack number.

Example on Windows 7:

If you want to find just the OS version, you can use ver command. Open command window and execute ver command. But note that this does not show service pack version.

This command does not show version on a Windows 7 system.

Get Windows Version

How to get the Windows Version from the System Registry

The Windows version is stored in the registry key: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion

The value CurrentVersion contains the version number as string(!):

Version Number: Operating System:
5.0 Windows 2000
5.1 Windows XP
5.2 Windows XP 64bit
5.2 Windows Server 2003 / R2
6.0 Windows Vista / Windows Server 2008
6.1 Windows 7 / Windows Server 2008 R2
6.2 Windows 8 / Windows Server 2012
6.3 Windows 8.1 / Windows Server 2012 R2
10.0 Windows 10 (Preview)

The value ProductName contains the system name, e.g. «Windows 8.1»

Helper function to read a string value from the registry:

CString GetStringFromReg(HKEY keyParent, CString keyName, CString keyValName)
<
CRegKey key;
CString out;
if (key.Open(keyParent, keyName, KEY_READ) == ERROR_SUCCESS)
<
ULONG len=256;
key.QueryStringValue(keyValName, out.GetBuffer(256), &len);
out.ReleaseBuffer();
key.Close();
>
return out;
>

Читайте также:  Как поменять разрешение экрана через реестр windows

Get the OS version (e.g. «6.3»)

CString osversion = GetStringFromReg(HKEY_LOCAL_MACHINE, L» SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion «, L» CurrentVersion «);

Get the OS name (e.g. «Windows 8.1»)

CString osname = GetStringFromReg(HKEY_LOCAL_MACHINE, L» SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion «, L» ProductName «);

©1997-2021 Arclab®. All other trademarks and brand names are the property of their respective owners.

How to get Windows version from command prompt or from PowerShell

But is there a way to get the exact version string using command line output similar to the one mentioned in the image?

The attached is the output of «winver» command from run. PS: I am looking for a batch or PowerShell command.

There are some alternates available to get the Windows version like this PowerShell command:

6 Answers 6

The following commands are is going to help you with that. If you need more information, just type in systeminfo:

The ver command shows something like this:

But in PowerShell (or Git Bash) you have to call it through the cmd command:

I found it somewhere, PowerShell:

To add to @Bonifacio ‘s answer:

Would be even better, because it returns only the ReleaseId value, which you could then pipe to a file. Especially useful if you have several hosts to deal with.

With system information you can only get the build with that value and go to Google to get the respective version.

However, one simple way is by searching the registry on the command line:

The reg query way suggested all output a little garbage.

Using a for loop with tokens will output clean information.

The tokens=3 refers to the third word from the original output.

You will need to double the % if running inside a bat file.

You can set the output as a variable by replacing echo %i with set build=%i

Also remember to escape ^ any special characters.

Lastly look at HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion for the string that has the required value. You may need to adjust the token count.

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:

Читайте также:  Nvidia forceware для windows 10

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.

Оцените статью