batch file registry comparison

Discussion in 'Software' started by Blyenth, Sep 26, 2004.

  1. Blyenth

    Blyenth Private E-2

    Hey guys, first time posting here so hopefully this will help me greatly...

    I am trying to write a batch file that will call up "hklm\software\microsoft\windows nt\currentversion\csdversion" and determine if Service Pack 2 is installed. If SP2 isn't installed, have it install it for me. Any help would be awesome thank you.

    Blyenth
     
  2. Blyenth

    Blyenth Private E-2

    I found the answer if anyone wants to know.....


    @ECHO OFF

    FOR /F "tokens=2* delims= " %%A IN ('REG QUERY "HKLM\software\Microsoft\windows nt\currentversion" /v csdversion') DO SET spver=%%B
    ECHO Service Pack Version = %spver%

    if not "%spver%" == "Service Pack 2" (
    echo install service pack 2
    rem **insert path and sp2 location here**
    )

    if "%spver%" == "Service Pack 2" (
    echo Service Pack 2 is installed
    )

    pause
     
  3. goldfish

    goldfish Lt. Sushi.DC

    Nope!

    Code:
    Service Pack Version = 2, v.2149
    install service pack 2
    Press any key to continue . . . 
    
    
    I have SP2 installed. You need to get the first charachter of the %spver% variable to get the SP number, after the comma is the build number
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds