13

Is there is a way to get service pack number from command line? Or the build number from command line (from which I can tell the service pack number (see How do I determine Windows Version and Service Pack from WindowsUpdateLog.txt))?

Upon starting cmd, part of the Windows version number is shown on the screen, but not the service pack number.

I prefer a non-PowerShell answer, but I wouldn't mind knowing about a PowerShell answer anyways since some computers I deal with do have it installed.

1

5 Answers 5

15

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

Source: Find windows version from command prompt

2
  • This is the only one that works on all computers I've tried these methods on. Oct 8, 2010 at 19:20
  • ps - the above only works if the user language is English, since the string filter uses the English names. Using systeminfo on its own will work for any language - though requires manual effort searching through all the data returned.
    – JohnLBevan
    Oct 3, 2012 at 13:59
10

You can get it using WMIC - wmic os get servicepackmajorversion

For more on using WMIC, see this little tutorial: http://quux.wiki.zoho.com/WMIC-Snippets.html

2
  • Is wmic installed on all Windows computers? for some reason, my home computer does not recognize wmic. Oct 1, 2010 at 16:51
  • 1
    Awesome tool, thanks for sharing! @Thr4wn, according to Wikipedia, WMIC is not available on Windows XP Home Edition, but is available on XP Pro and all later versions of Windows.
    – nhinkle
    Oct 1, 2010 at 20:18
6

You can type in CMD:

Winver

6
  • nice answer! .... +1 when i get more votes
    – studiohack
    Sep 30, 2010 at 20:49
  • 2
    Hm... problem with that is, it opens a GUI tool, which may not be what the user is attempting to do.
    – nhinkle
    Sep 30, 2010 at 21:05
  • 2
    SYSTEMINFO run in a command prompt will display without GUI.
    – r0ca
    Sep 30, 2010 at 21:16
  • 1
    In cmd.exe you can use just ver and get the version on stdout. But you need to convert the build number to get the SP.
    – Richard
    Oct 1, 2010 at 8:26
  • ver doesn't give the full version number. It stops right before the service pack number. Oct 1, 2010 at 16:49
2

You can get it from the command line by querying the registry for the ServicePack key. If an SP is installed, it will be shown, otherwise, it will say that it was unable to locate the specified key, in which case there is no service pack.

reg query "HKLM\Software\Microsoft\Windows NT\CurrentVersion" /v ServicePack
4
  • This only works if there is a Service Pack installed (e.g. currently Windows 7 does not have a Service Pack so the key does not exist) Oct 1, 2010 at 11:14
  • I know; that's what I stated in my answer. If the key doesn't exist, then there is no service pack, thus it is SP0. If the key does exist, it'll tell you the service pack. So either way, you can figure out what service pack (if any) is installed.
    – nhinkle
    Oct 1, 2010 at 20:17
  • When I try Giri's solution, it shows SP 3, but this method reports that it was unable to find the specified registry key or value (I copied/pasted the command into cmd). Oct 8, 2010 at 19:19
  • Instead of "ServicePack", you can use "ProductName" and "CSDVersion"
    – d.moncada
    Sep 25, 2015 at 15:52
0

You can use this:

wmic os get csdversion /format:value

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .