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 show service pack number, OS edition and build number etc.
Find Windows Version from CMD
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
Find version using WMI
Run the below WMIC command to get OS version and the service pack number.
wmic os get Caption,CSDVersion /value
Example on Windows 7:
c:\>wmic os get Caption,CSDVersion /value Caption=Microsoft Windows 7 Enterprise CSDVersion=Service Pack 1
Check Windows version from Run
- Open Run dialog from Start menu/Use the keyboard shortcut [Windows + R]
- Execute command ‘winver’
Finding version using ver command
In older versions of Windows, ver command was showing the Windows version on cmd.
C:\>ver Microsoft Windows XP [Version 5.1.2600] C:\>