≡ Menu

Find windows OS version from command line

Windows has command line utilities that show us the version of the Windows OS we are using including the service pack number.

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

Microsoft Windows XP [Version 5.1.2600]

As you can see above, ver command just tells you the OS name but not the service pack number you are using. We can find service pack number as well as the OS name using Systeminfo command. But Systeminfo dumps lot of other information also. So we need to use findstr command to filter out unwanted information.

systeminfo | findstr /B /C:"OS Name" /C:"OS Version"


C:\>systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
Microsoft Windows XP Professional
OS Version:                5.1.2600 Service Pack 2 Build 2600

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

systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
OS Name:                   Microsoft Windows 7 Ultimate
OS Version:                6.1.7600 N/A Build 7600

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

c:\>systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
OS Name:                   Microsoft Windows 7 Enterprise
OS Version:                6.1.7601 Service Pack 1 Build 7601

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

C:\>systeminfo | findstr /C:"OS"
OS Name:                   Microsoft Windows Server 2008 R2 Enterprise
OS Version:                6.1.7600 N/A Build 7600
OS Manufacturer:           Microsoft Corporation
OS Configuration:          Standalone Server
OS Build Type:             Multiprocessor Free
BIOS Version:              IBM -[BWE117AUS-1.05]-, 7/28/2005

Using WMI:

The below wmi command gives the OS and the service pack version.

wmic os get Caption,CSDVersion /value

Example on Win7:

c:\>wmic os get Caption,CSDVersion /value
Caption=Microsoft Windows 7 Enterprise
CSDVersion=Service Pack 1

Also Read:
Windows CMD commands reference

{ 36 comments… add one }
  • Suchitra February 2, 2010, 7:41 am

    How to find windows edition ?

    • pradip November 13, 2013, 9:18 am

      type systeminfo in cmd

  • Techblogger February 12, 2010, 5:45 pm

    Execute 'Winver' from command prompt or from Run window. It will show you the windows version.

  • Monk April 17, 2010, 11:31 pm

    The "systeminfo" command gives the edition info under the headings "OS Name:" and "OS Version:" as well as a lot of other information all in the console. You can parse it with "findstr" if you need only the edition info:

    systeminfo | findstr /B /C:"OS Name" /C:"OS Version"

  • Anonymous August 19, 2010, 3:13 pm

    I was looking for this…I had to write a script which runs on different windows editions and I need to capture the os name..this post helped me..thank you..

  • Anonymous October 24, 2010, 2:51 pm

    Very helpful if I want to do a remote command without GUI. Thanks a ton!

  • Amit November 19, 2010, 2:20 am

    Thanks friend for the tip..I need to find os version from windows dos and this has helped me..

  • Anonymous November 23, 2010, 6:58 pm

    Thank you a lot!

    I realy needed this tip.

  • Raj May 31, 2011, 5:46 pm

    How can I script this for multiple servers and save the output in csv format?

  • Techblogger June 1, 2011, 7:25 am

    Run the below command on each of the servers.

    wmic os get buildnumber,caption,CSDVersion /format:csv 

    On my xp system it prints the following data.

    techblogger-pc,2600,Microsoft Windows XP Professional,Service Pack 2

    You can use psexec.exe or rsh tool to run this command remotely on the servers.

  • Anonymous June 24, 2011, 5:43 pm

    How to find the bit size?

    • *Santhosh* January 28, 2014, 11:53 am

      you can this command
      c:/>wmic os get osarchitecture

  • Techblogger June 26, 2011, 1:16 pm

    systeminfo | findstr /C:"System type" would give you the processor architecture. From this you can derive if it's 32 or 64 bit. You can also use wmic cpu command to get processor info.

  • Anonymous July 15, 2011, 8:09 am

    How to get the OS name and version for a list of servers ?

  • Techblogger July 15, 2011, 8:16 am

    Run the command mentioned in the post on each of the servers using psexec or rsh. I will soon add a post on psexec.

  • Anonymous August 12, 2011, 7:49 am
    WMIC /node:RemoteComputerName os get buildnumber,caption,CSDVersion /format:csv 

    The above can be used to retrieve information from a remote computer

  • Lucas November 2, 2011, 12:01 pm

    I need to find the image version of a windows 7 installation. What command do I use to find out?

    • admin November 2, 2011, 5:04 pm

      If I have understood correctly, you have different images of Win7 and you want to find out which image you have installed on the computer? AFAIK, windows can’t do that.
      I can think of a workaround for this. You can add custom reg key and set the image version number in that and then create the image. And on the installed computer, you can do reg query from command line.

  • Tim Kessler December 7, 2011, 1:44 pm

    The quotes are incorrect ASCII characters (MS Office quotes).

    Use this version instead:

    systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
    • admin December 7, 2011, 3:53 pm

      I’ve fixed the issue in the post. Copy pasting the command would work fine now. Thank you for pointing that out.

  • fred July 3, 2012, 11:21 am

    No support for systeminfo within xp home

  • Jordan February 11, 2013, 10:13 am

    Thanks thats really useful, handy when your talking to customers and trying to get that info. also useful when you are providing remote assistance, and need to know. I took what you had, and added a few lines, incase anyone will find it useful:

    echo ****************************************
    echo ****************************************
    wmic computersystem get manufacturer
    wmic csproduct get Name
    wmic os get caption
    wmic computersystem get systemtype
    wmic bios get serialnumber
    echo ****************************************

    When Run, this displays the following info:

    Microsoft Windows 7 Professional
    x64-based PC
    Press any key to continue . . .


  • Kelly March 5, 2013, 1:03 pm

    How can I get the serial number from a Windows Server 2000 device. wmic bios get serialnumber does not work on this windows version. PLEASE HELP

  • J0545 April 16, 2013, 9:55 pm

    anybody know how can do that but in vbscript or .vbs file

  • London May 11, 2013, 3:05 pm

    strComputer = “localhost”
    Set objWMIService = GetObject(“winmgmts:” _
    & “{impersonationLevel=impersonate}!\\” _
    & strComputer & “\root\cimv2”)
    Set colOSes = objWMIService.ExecQuery(“Select * from Win32_OperatingSystem”)
    For Each objOS in colOSes
    Wscript.Echo “Version: ” & objOS.Version ‘Version & build
    Wscript.Echo “OS Type: ” & objOS.OSType

  • Vikas Thakor October 22, 2013, 1:09 pm

    just type “winver” command in run and
    you will get windows version information on GUI.

  • sadakar December 21, 2013, 8:52 am

    Nice post… thank you..
    Checked when installing mango db ..

    wmic command is not working …. any idea on the same ? What could be the probable solution to make work of wmic command ?

  • radhika September 19, 2014, 6:27 am

    checked a few sites.. but found the exact answer..thx..

  • Mohamed October 23, 2014, 12:17 pm

    I cannot access cmd in windows 2008

  • shailesh January 30, 2015, 5:33 am

    i want to know the o.s. details of remote computer through command prompt or program….

  • Sharath April 21, 2015, 1:11 pm

    Thank you very much.

    This was exactly the info I was looking for.
    Rest of the ‘Comments’ were also very informative. Thank you all you guys.


  • Anu August 1, 2015, 5:22 am

    Thank You so much. I am using windows 7 but the systeminfo cmd isn’t work. when i typed, it displays “systeminfo” is not recognized as internal & external cmd. How to solve this problem??

    • yogesh September 19, 2015, 11:29 am

      Hi anu,
      check spelling once it will work correctly. in any version of windows. or simply try this command to take your version detail on notepad file “systeminfo >> notepad.txt”
      hope it will help you 🙂

  • NicT September 24, 2015, 10:49 pm

    6 years from original post and still useful for another person. Thanks very much.

  • Krzysiu March 20, 2016, 12:47 pm

    Hey! Please, use the first way only to yourself. The first way is slow, but most importantly – it won’t work for other locales than EN. For other locales it will get either blank result or incorrect result. This post is old, these were different times. As a coder, I’d say that nowadays second way is safe to use. There’s no point in keeping compatibility for OS made 15 years ago (XP).

Leave a Comment