Bat command???

Discussion in 'Windows 7' started by lunar21, Sep 8, 2009.

  1. lunar21

    lunar21 MDL Addicted

    Dec 14, 2008
    #1 lunar21, Sep 8, 2009
    Last edited by a moderator: Apr 20, 2017
    Hello yall I have a bat file I made for the Win 7 updates posted here earlyer. What I would like to add is a code that searches the computer first to see if any of these files are already installed, and if so don't install them. If there is a command for that please let me know. Below is the inside of my bat file.

    @echo off
    set /p answer=Do you wish to install updates? (Y/N):
    if %answer% == Y goto install
    if %answer% == y goto install
    if %answer% == N goto exit
    if %answer% == n goto exit
    echo Please wait.....
    Windows6.1-KB123334-x86.msu /quiet /norestart
    Windows6.1-KB123456-x86.msu /quiet /norestart
    Windows6.1-KB123456-v1.1-x86.msu /quiet /norestart
    Windows6.1-KB123456-v2-x86.msu /quiet /norestart
    Windows6.1-KB674101-x86.msu /quiet /norestart
    Windows6.1-KB674103-x86.msu /quiet /norestart
    Windows6.1-KB675605-x86.msu /quiet /norestart
    Windows6.1-KB675605-v2-x86.msu /quiet /norestart
    Windows6.1-KB675606-x86.msu /quiet /norestart
    Windows6.1-KB915597-x86.exe /s /norestart
    Windows6.1-KB958488-v6001-x86.msu /quiet /norestart
    Windows6.1-KB958830-x86.msu /quiet /norestart
    Windows6.1-KB968771-x86.msu /quiet /norestart
    Windows6.1-KB971012-x86.msi /quiet /norestart
    Windows6.1-KB972636-x86.msu /quiet /norestart
    Windows6.1-KB973525-x86.msu /quiet /norestart
    Windows6.1-KB973525-v1.1-x86.msu /quiet /norestart
    Windows6.1-KB973529-x86.msu /quiet /norestart
    Windows6.1-KB973751-x86.msu /quiet /norestart
    Windows6.1-KB973874-x86.msu /quiet /norestart
    Windows6.1-KB974039-v2-x86.msu /quiet /norestart
    Windows6.1-KB974138-x86.msu /quiet /norestart
    Windows6.1-KB974176-x86.msu /quiet /norestart
    Windows6.1-KB974179-x86.msu /quiet /norestart
    Windows6.1-KB974204-x86.msu /quiet /norestart
    Windows6.1-KB974204-v2-x86.msu /quiet /norestart
    Windows6.1-KB974324-x86.msu /quiet /norestart
    Windows6.1-KB974327-x86.msu /quiet /norestart
    Windows6.1-KB974332-x86.msu /quiet /norestart
    Windows6.1-KB974332-v1.1-x86.msu /quiet /norestart
    Windows6.1-KB974431-x86.msu /quiet /norestart
    Windows6.1-KB974473-x86.msu /quiet /norestart
    Windows6.1-KB974537-x86.msu /quiet /norestart
    Windows6.1-KB974560-x86.msu /quiet /norestart
    Windows6.1-KB974571-x86.msu /quiet /norestart
    Windows6.1-KB974598-x86.msu /quiet /norestart
    Windows6.1-KB974638-x86.msu /quiet /norestart
    Windows6.1-KB974719-x86.msu /quiet /norestart
    Windows6.1-KB974817-x86.msu /quiet /norestart
    Windows6.1-KB974912-x86.msu /quiet /norestart
    Windows6.1-KB974940-v2-x86.msu /quiet /norestart
    goto end
    set /p answer=Do you wish to restart? (Y/N):
    if %answer% == Y goto shutdown
    if %answer% == y goto shutdown
    if %answer% == N goto exit
    if %answer% == n goto exit
    shutdown /r /f /t 0
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. Mr Jinje

    Mr Jinje MDL Expert

    Aug 19, 2009
    You might not need to change anything. The /quiet switch should just abort if the update has already been applied and move on to next msu.

    Real easy to test, time how long it takes the script on virgin machine, reboot and then run the script a second time on same machine. Second time should only take a couple of seconds if I am right.
  3. PrEzi

    PrEzi MDL Addicted

    Aug 23, 2007
    Yes, you are right.
    Already tried it on a rig that had a few updates already installed and they took 2-3 seconds to 'install' and move on to the next updates.
    The next launch it took 2-3 seconds for each of the updates (like it would skip them in the background)/
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. George King

    George King MDL Senior Member

    Aug 5, 2009
    #4 George King, Sep 8, 2009
    Last edited by a moderator: Apr 20, 2017