Jump to content

How to properly query the service pack version from the registry


robotnik

Recommended Posts


That's a huge step in the right direction but does anyone know how to save the result of the reg query command to a variable? Ive tried using %1%, %1 and %%i in the following manner:

for /f "skip=4 tokens=3" %%? in ('HKLM\Software\Microsoft\Windows NT\CurrentVersion" /v CSDVersion') do set CSDVersion=%%?
set CSDVersion=%CSDVersion:~-3%

reg query "HKLM\Software\Microsoft\Windows NT\CurrentVersion" /v CSDVersion"
if %1% == "Service Pack 1" go to runupdates
if %1% == "Service Pack 2" go to end

On another note, I found this link that has what I need but I cant seem to get the syntax of the IF and GO TO statements correct: http://fixunix.com/ms-dos/271139-read-os-s...evel-batch.html

Thanks in advance!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...