Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 http://superuser.com/questions/61944/how-do-i-determine-windows-version-and-service-pack-from-windowsupdatelog-txt))?

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

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

share|improve this question
    

4 Answers 4

up vote 8 down vote accepted

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

Source: http://www.windows-commandline.com/2009/01/find-windows-os-version-from-command.html

share|improve this answer
    
This is the only one that works on all computers I've tried these methods on. –  Alexander Bird Oct 8 '10 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 '12 at 13:59

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

share|improve this answer
    
Is wmic installed on all Windows computers? for some reason, my home computer does not recognize wmic. –  Alexander Bird Oct 1 '10 at 16:51
    
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 '10 at 20:18

You can type in CMD:

Winver

share|improve this answer
    
nice answer! .... +1 when i get more votes –  studiohack Sep 30 '10 at 20:49
1  
Hm... problem with that is, it opens a GUI tool, which may not be what the user is attempting to do. –  nhinkle Sep 30 '10 at 21:05
2  
SYSTEMINFO run in a command prompt will display without GUI. –  r0ca Sep 30 '10 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 '10 at 8:26
    
ver doesn't give the full version number. It stops right before the service pack number. –  Alexander Bird Oct 1 '10 at 16:49

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
share|improve this answer
    
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) –  misterjaytee Oct 1 '10 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 '10 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). –  Alexander Bird Oct 8 '10 at 19:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.