Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Echo off
- SETLOCAL EnableDelayedExpansion
- for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
- set "DEL=%%a"
- )
- title Windows 7 Quick Patch V .3
- cls
- :checkPrivileges
- NET FILE 1>NUL 2>NUL
- if '%errorlevel%' == '0' ( goto prechk) else ( goto getPrivileges )
- :getPrivileges
- if '%1'=='ELEV' (shift & goto prechk)
- for /f "delims=: tokens=*" %%A in ('findstr /b ::- "%~f0"') do @echo(%%A
- setlocal DisableDelayedExpansion
- set "batchPath=%~0"
- setlocal EnableDelayedExpansion
- Echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs"
- Echo UAC.ShellExecute "!batchPath!", "ELEV", "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs"
- "%temp%\OEgetPrivileges.vbs"
- exit /B
- :prechk
- set /p var=<C:\Step.txt
- call :%var% 2> NUL
- :Start
- cls
- Echo.
- Echo This script is based off of information from:
- Echo.
- Echo http://www.freenode-windows.org/resources/vista-7/windows-update
- Echo.
- Echo This script is brought to you by Solaris17 of TPU
- Echo.
- Echo This script is for Windows 7. I didnt put alot of failsafe time into it.
- Echo.
- Echo This script should automatically run after rebooting.
- Echo.
- pause
- copy %0 "%USERPROFILE%\Start Menu\Programs\Startup"
- mkdir C:\Win7qUD
- set /p var=<C:\Step.txt
- call :%var% 2> NUL
- :detect
- @Echo off
- cls
- ver | findstr /i "5\.1\." > nul
- IF %ERRORLEVEL% EQU 0 goto warn
- ver | findstr /i "5\.2\." > nul
- IF %ERRORLEVEL% EQU 0 goto warn
- ver | findstr /i "6\.0\." > nul
- IF %ERRORLEVEL% EQU 0 goto warn
- ver | findstr /i "6\.1\." > nul
- IF %ERRORLEVEL% EQU 0 goto archchk
- ver | findstr /i "6\.2\." > nul
- IF %ERRORLEVEL% EQU 0 goto warn
- ver | findstr /i "6\.3\." > nul
- IF %ERRORLEVEL% EQU 0 goto warn
- ver | findstr /i "10\.0\." > nul
- IF %ERRORLEVEL% EQU 0 goto warn
- goto warn
- :warn
- Echo.
- Echo This is not Windows 7. This wont work for you.
- Echo.
- pause
- goto exit
- :archchk
- Echo.
- IF EXIST "%PROGRAMFILES(X86)%" (GOTO 64BIT) ELSE (GOTO 32BIT)
- :64BIT
- goto 64step1
- :64step1
- @echo 64step1 > C:\Step.txt
- :: Kill Services and folders
- cls
- Echo.
- Echo Step 1 of 6
- Echo.
- Echo Killing Services etc
- SC stop wuauserv
- rmdir c:\windows\softwaredistribution\WuRedir /s /q
- :64step2
- @echo 64step2 > C:\Step.txt
- :: Download KB fixes x64
- cls
- echo.
- Echo Step 2 of 6
- Echo.
- Echo Downloading KB updates.
- Echo.
- bitsadmin.exe /transfer "KB3020369" https://download.microsoft.com/download/5/D/0/5D0821EB-A92D-4CA2-9020-EC41D56B074F/Windows6.1-KB3020369-x64.msu C:\Win7qUD\1st.msu
- bitsadmin.exe /transfer "KB3172605" https://download.microsoft.com/download/5/6/0/560504D4-F91A-4DEB-867F-C713F7821374/Windows6.1-KB3172605-x64.msu C:\Win7qUD\2nd.msu
- bitsadmin.exe /transfer "KB3125574" http://download.windowsupdate.com/d/msdownload/update/software/updt/2016/05/windows6.1-kb3125574-v4-x64_2dafb1d203c8964239af3048b5dd4b1264cd93b9.msu C:\Win7qUD\3rd.msu
- :64step3
- @echo 64step3 > C:\Step.txt
- :: Installing first MSU
- cls
- Echo.
- Echo Step 3 of 6
- Echo.
- Echo Starting Install...
- Echo.
- Echo Should take about 15min; reboot if machine hangs.
- Echo.
- Echo If the installer prompts for reboot just hit CLOSE^^!
- Echo.
- Start /wait C:\Win7qUD\1st.msu /quiet
- shutdown /r /t 60 /c "Rebooting: Process will continue after restart."
- @echo 64step4 > C:\Step.txt
- exit
- :64step4
- @echo 64step4 > C:\Step.txt
- :: Installing second MSU
- cls
- Echo.
- Echo Step 4 of 6
- Echo.
- Echo Starting Install...
- Echo.
- Echo Should take about 15min; reboot if machine hangs.
- Echo.
- Echo If the installer prompts for reboot just hit CLOSE^^!
- Echo.
- Start /wait C:\Win7qUD\2nd.msu /quiet
- shutdown /r /t 60 /c "Rebooting: Process will continue after restart."
- @echo 64step5 > C:\Step.txt
- exit
- :64step5
- @echo 64step5 > C:\Step.txt
- :: Installing third MSU
- cls
- Echo.
- Echo Step 5 of 6
- Echo.
- Echo Starting Install...
- Echo.
- Echo Should take about 35min; reboot if machine hangs.
- Echo.
- Echo If the installer prompts for reboot just hit CLOSE^^!
- Echo.
- Echo To check to see if its working "TrustedInstaller" should be going nuts.
- Start /wait C:\Win7qUD\3rd.msu /quiet
- shutdown /r /t 60 /c "Rebooting: Process will continue after restart."
- @echo 64step6 > C:\Step.txt
- exit
- :64step6
- Echo.
- :: Cleaning up files etc
- cls
- rmdir C:\Win7qUD /s /q
- del C:\Step.txt
- Echo.
- Echo Step 6 of 6
- Echo.
- Echo Complete^^!
- Echo.
- Echo You should now be able to continue Windows updates as normal.
- Echo.
- Echo You can delete this script after it closes if you wish.
- Echo.
- Echo This script will now delete itself from startup.
- Echo.
- pause
- del "%USERPROFILE%\Start Menu\Programs\Startup\*.bat"
- goto exit
- :32BIT
- goto 32step1
- :32step1
- @echo 32step1 > C:\Step.txt
- :: Kill Services and folders
- cls
- Echo.
- Echo Step 1 of 6
- Echo.
- Echo Killing Services etc
- SC stop wuauserv
- rmdir c:\windows\softwaredistribution\WuRedir /s /q
- :32step2
- @echo 32step2 > C:\Step.txt
- :: Download KB fixes x86
- cls
- echo.
- Echo Step 2 of 6
- Echo.
- Echo Downloading KB updates.
- Echo.
- bitsadmin.exe /transfer "KB3020369" https://download.microsoft.com/download/C/0/8/C0823F43-BFE9-4147-9B0A-35769CBBE6B0/Windows6.1-KB3020369-x86.msu C:\Win7qUD\1st.msu
- bitsadmin.exe /transfer "KB3172605" https://download.microsoft.com/download/C/D/5/CD5DE7B2-E857-4BD4-AA9C-6B30C3E1735A/Windows6.1-KB3172605-x86.msu C:\Win7qUD\2nd.msu
- bitsadmin.exe /transfer "KB3125574" http://download.windowsupdate.com/d/msdownload/update/software/updt/2016/05/windows6.1-kb3125574-v4-x86_ba1ff5537312561795cc04db0b02fbb0a74b2cbd.msu C:\Win7qUD\3rd.msu
- :32step3
- @echo 32step3 > C:\Step.txt
- :: Installing first MSU
- cls
- Echo.
- Echo Step 3 of 6
- Echo.
- Echo Starting Install...
- Echo.
- Echo Should take about 15min; reboot if machine hangs.
- Echo.
- Echo If the installer prompts for reboot just hit CLOSE^^!
- Echo.
- Start /wait C:\Win7qUD\1st.msu /quiet
- shutdown /r /t 60 /c "Rebooting: Process will continue after restart."
- @echo 32step4 > C:\Step.txt
- exit
- :32step4
- @echo 32step4 > C:\Step.txt
- :: Installing second MSU
- cls
- Echo.
- Echo Step 4 of 6
- Echo.
- Echo Starting Install...
- Echo.
- Echo Should take about 15min; reboot if machine hangs.
- Echo.
- Echo If the installer prompts for reboot just hit CLOSE^^!
- Echo.
- Start /wait C:\Win7qUD\2nd.msu /quiet
- shutdown /r /t 60 /c "Rebooting: Process will continue after restart."
- @echo 32step5 > C:\Step.txt
- exit
- :32step5
- @echo 32step5 > C:\Step.txt
- :: Installing third MSU
- cls
- Echo.
- Echo Step 5 of 6
- Echo.
- Echo Starting Install...
- Echo.
- Echo Should take about 35min; reboot if machine hangs.
- Echo.
- Echo If the installer prompts for reboot just hit CLOSE^^!
- Echo.
- Echo To check to see if its working "TrustedInstaller" should be going nuts.
- Start /wait C:\Win7qUD\3rd.msu /quiet
- shutdown /r /t 60 /c "Rebooting: Process will continue after restart."
- @echo 32step6 > C:\Step.txt
- exit
- :32step6
- Echo.
- :: Cleaning up files etc
- cls
- rmdir C:\Win7qUD /s /q
- del C:\Step.txt
- echo.
- Echo Step 6 of 6
- Echo.
- Echo Complete^^!
- Echo.
- Echo You should now be able to continue Windows updates as normal.
- Echo.
- Echo You can delete this script after it closes if you wish.
- Echo.
- Echo This script will now delete itself from startup.
- Echo.
- pause
- del "%USERPROFILE%\Start Menu\Programs\Startup\*.bat"
- goto exit
- :exit
- rmdir C:\Win7qUD /s /q
- del C:\Step.txt
- exit
- ::v3 Added /quiet | Fixed bug with other windows versions leaving script in startup. | Put check for previous run at head to skip start text.
Add Comment
Please, Sign In to add comment