Command line which windows version

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.

Command-Line Reference

Applies To: Windows Server 2003, Windows Vista, Windows XP, Windows Server 2008, Windows 7, Windows Server 2003 R2, Windows Server 2008 R2, Windows Server 2000, Windows Server 2012, Windows 8

Use this topic to find the documentation resources and other technical information that you need to learn about the command shell, and to automate command-line tasks by using scripts or scripting tools.

To read introductory information about the command shell and command-line tools, see Feature description. To see a listing of new and deprecated command-line tools see New and deprecated functionality.

To find information about a specific command, in the following A-Z menu, click the letter that the command starts with, and then click the command name.

Prerequisites

The information that is contained in this overview applies to:

Windows Server 2012

WindowsВ ServerВ 2008В R2

WindowsВ ServerВ 2008

WindowsВ ServerВ 2003В R2

WindowsВ ServerВ 2003

Feature description

New and deprecated functionality

New or Deprecated?

Create a new cluster or configure an existing cluster.

Читайте также:  Речевой интерфейс для windows

Configure DFS folders and folder targets in a DFS namespace.

Creates and manages File Server Resource Manager quotas.

Create and manage file groups, file screens, file screen exceptions, and file screen templates that are used to configure general administrative options for screening files.

Enable optional features in Windows by downloading required files from WindowsВ Update or a source that Group Policy specifies.

Read, write, run, debug, and test Windows PowerShell scripts and modules in a friendly, graphic-assisted environment.

Install or remove roles, role services, and features.

Monitor an RD Session Host session.

Create and manage storage reports and storage report tasks, and configure general administrative options for File Server Resource Manager.

Command shell overview

The command shell is a software program that provides direct communication between the user and the operating system. The non-graphical, command shell user interface provides the environment in which you run character-based applications and utilities. The command shell executes programs and displays their output on the screen by using individual characters similar to the MS-DOS command interpreter, Command.com. The command shell in the Windows Server operating system uses the command interpreter, Cmd.exe. Cmd.exe loads applications, directs the flow of information between applications, and translates user input into a form that the operating system understands.

You can use the command shell to create and edit scripts to automate routine tasks. For example, you can create simple scripts in batch (.bat) files to automate the management of user accounts or nightly backups. You can also use the command-line version of Windows Script Host to run more sophisticated scripts in the command shell. For more information, see Cscript or Wscript. You can perform operations more efficiently by using scripts than you can by using the user interface. Scripts accept all commands that are available at the command line.

Customize the Command Prompt window

You can change the properties for the Command Prompt window.

To configure the Command Prompt window

Open a Command Prompt window, click the upper-left corner of the Command Prompt window, and then click Properties. (Or to open Command Prompt Properties from the keyboard, press ALT+SPACEBAR+P.)

Click the Options tab.

In Command History, type or select 999 in Buffer Size, and then type or select 5 in Number of Buffers. By increasing the screen buffer size to 999, you enable scrolling through the Command Prompt window. By increasing the number of buffers to five, you increase the number of lines in the Command Prompt window to 5000.

In Edit Options, select the Quick Edit Mode and Insert Mode check boxes.

Click the Layout tab.

In Screen Buffer Size, type or select 2500 in Height.

To further customize your Command Prompt window settings, perform any of the following optional tasks:

In Screen Buffer Size, increase Width.

In Window Size, increase Height.

In Window Size, increase Width.

Clear the Let system position window check box, and then, in Window Position, change the values in Left and Top.

Читайте также:  Как узнать свой код активации windows 10 через командную строку

In the Apply Properties dialog box, click Save properties for future windows with same title.

To enable or disable file and directory name completion on a computer or user logon session, run Regedit.exe and set the following REG_DWORD value : HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\CompletionChar\REG_DWORD To set the REG_DWORD value, use the hexadecimal value of a control character for a particular function (for example, 0Г—9 is Tab and 0Г—08 is Backspace). User-specified settings take precedence over computer settings, and command-line options take precedence over registry settings.

Incorrectly editing the registry may severely damage your system. Before making changes to the registry, you should back up any valued data on the computer.

Command-line reference A-Z

To find information about a specific command, in the following A-Z menu, click the letter that the command starts with, and then click the command name.

Each command-line tool topic displays the version of Windows that is supported by the command-line tool.

Windows: Command line to read version info of an executable file?

Does Windows have an executable that I can run in the command shell which returns the version number of an executable (.exe) file?

I see a lot of questions that show how to do it from different languages, and references to third party software to write it, but I can’t find a simple shell command to do it. Additional points if I don’t need to install anything.

It must be run as normal user. Not administrator.

7 Answers 7

You can use wmic to do it. And you can wrap it into a batch file

Save it as (example) getVersion.cmd and call as getVersion.cmd «c:\windows\system32\msiexec.exe»

edited to adapt to comments and not require administrator rights. In this case, an hybrid cmd/javascript file is used to query wmi. Same usage

If you are willing and able to use PowerShell, the following code will work. If you are on a supported Windows system, PowerShell will be available.

If you must run it in a cmd.exe shell, you could use:

This will give you only the file version:

and one way with makecab :

example output (it has a string version which is a small addition to wmic method 🙂 ):

also you can take a look at tooltipinfo.bat

filever c:\windows\system32\notepad.exe (the filever is preinstalled on every Windows OS).

filever.exe is in SUPPORT.CAB from the Windows 2003 Support tools, and maybe other places.

A method using VBScript and Scripting.FileSystemObject from a CMD script

A variant of the powershell method, if you are calling from a CMD script. Using FileVersionRaw instead of FileVersion, because FileVersion can have extra text decoration, but have to ToString() to get the expected format.

A Powershell from CMD method to compare versions, as that could be the reason for asking in the first place. Have to use %ErrorLevel%==x because ErrorLevel==x is actually greater or equal.

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.

Читайте также:  Как отключить приложение получить windows 10

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.

What version of Windows do I have?

As a Windows user, it’s important to know which operating system version you are using. You need this information when installing new programs and also for troubleshooting.

Microsoft provides details about the Windows version installed on your computer in several places in the operating system, e.g. in the Control Panel. There are three different ways of accessing the relevant system information. Let’s take a look at them now.

Checking your Windows version using a keyboard shortcut

The quickest way to find out your Windows version is using a keyboard shortcut. On newer systems, the steps are as follows:

  1. Simultaneously press the [Windows] key and the [Pause] key.
  2. A system information window will appear.

Under the heading “View basic information about your computer”, you will see the name of your operating system, e.g. Windows 10 Enterprise.

The window also contains an overview of the technical characteristics of your system, for example: processor architecture, installed memory (RAM) and system type (i.e. 32-bit or 64-bit). The next section shows the name of your computer and network domain settings. You can also see whether or not your Windows version is activated.

The system information window therefore contains all the information you need in order to install new programs.

However, it does not give you detailed information about your Windows version, such as the version number or the OS build number. You need this information if you want to check whether your operating system has all of the latest updates for example.

The [Windows] key + [Pause] key shortcut does not work on older Windows systems.

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