Guest User

Untitled

a guest
Sep 30th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.35 KB | None | 0 0
  1. @Echo off
  2. SETLOCAL EnableDelayedExpansion
  3. for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
  4. set "DEL=%%a"
  5. )
  6. title Windows 7 Quick Patch V .3
  7. cls
  8.  
  9. :checkPrivileges
  10. NET FILE 1>NUL 2>NUL
  11. if '%errorlevel%' == '0' ( goto prechk) else ( goto getPrivileges )
  12.  
  13. :getPrivileges
  14. if '%1'=='ELEV' (shift & goto prechk)
  15. for /f "delims=: tokens=*" %%A in ('findstr /b ::- "%~f0"') do @echo(%%A
  16. setlocal DisableDelayedExpansion
  17. set "batchPath=%~0"
  18. setlocal EnableDelayedExpansion
  19. Echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs"
  20. Echo UAC.ShellExecute "!batchPath!", "ELEV", "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs"
  21. "%temp%\OEgetPrivileges.vbs"
  22. exit /B
  23.  
  24. :prechk
  25. set /p var=<C:\Step.txt
  26. call :%var% 2> NUL
  27.  
  28. :Start
  29. cls
  30. Echo.
  31. Echo This script is based off of information from:
  32. Echo.
  33. Echo http://www.freenode-windows.org/resources/vista-7/windows-update
  34. Echo.
  35. Echo This script is brought to you by Solaris17 of TPU
  36. Echo.
  37. Echo This script is for Windows 7. I didnt put alot of failsafe time into it.
  38. Echo.
  39. Echo This script should automatically run after rebooting.
  40. Echo.
  41. pause
  42. copy %0 "%USERPROFILE%\Start Menu\Programs\Startup"
  43. mkdir C:\Win7qUD
  44. set /p var=<C:\Step.txt
  45. call :%var% 2> NUL
  46.  
  47. :detect
  48. @Echo off
  49. cls
  50. ver | findstr /i "5\.1\." > nul
  51. IF %ERRORLEVEL% EQU 0 goto warn
  52. ver | findstr /i "5\.2\." > nul
  53. IF %ERRORLEVEL% EQU 0 goto warn
  54. ver | findstr /i "6\.0\." > nul
  55. IF %ERRORLEVEL% EQU 0 goto warn
  56. ver | findstr /i "6\.1\." > nul
  57. IF %ERRORLEVEL% EQU 0 goto archchk
  58. ver | findstr /i "6\.2\." > nul
  59. IF %ERRORLEVEL% EQU 0 goto warn
  60. ver | findstr /i "6\.3\." > nul
  61. IF %ERRORLEVEL% EQU 0 goto warn
  62. ver | findstr /i "10\.0\." > nul
  63. IF %ERRORLEVEL% EQU 0 goto warn
  64. goto warn
  65.  
  66. :warn
  67. Echo.
  68. Echo This is not Windows 7. This wont work for you.
  69. Echo.
  70. pause
  71. goto exit
  72.  
  73. :archchk
  74. Echo.
  75. IF EXIST "%PROGRAMFILES(X86)%" (GOTO 64BIT) ELSE (GOTO 32BIT)
  76.  
  77. :64BIT
  78. goto 64step1
  79.  
  80. :64step1
  81. @echo 64step1 > C:\Step.txt
  82. :: Kill Services and folders
  83. cls
  84. Echo.
  85. Echo Step 1 of 6
  86. Echo.
  87. Echo Killing Services etc
  88. SC stop wuauserv
  89. rmdir c:\windows\softwaredistribution\WuRedir /s /q
  90.  
  91.  
  92. :64step2
  93. @echo 64step2 > C:\Step.txt
  94. :: Download KB fixes x64
  95. cls
  96. echo.
  97. Echo Step 2 of 6
  98. Echo.
  99. Echo Downloading KB updates.
  100. Echo.
  101. 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
  102. 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
  103. 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
  104.  
  105. :64step3
  106. @echo 64step3 > C:\Step.txt
  107. :: Installing first MSU
  108. cls
  109. Echo.
  110. Echo Step 3 of 6
  111. Echo.
  112. Echo Starting Install...
  113. Echo.
  114. Echo Should take about 15min; reboot if machine hangs.
  115. Echo.
  116. Echo If the installer prompts for reboot just hit CLOSE^^!
  117. Echo.
  118. Start /wait C:\Win7qUD\1st.msu /quiet
  119. shutdown /r /t 60 /c "Rebooting: Process will continue after restart."
  120. @echo 64step4 > C:\Step.txt
  121. exit
  122.  
  123. :64step4
  124. @echo 64step4 > C:\Step.txt
  125. :: Installing second MSU
  126. cls
  127. Echo.
  128. Echo Step 4 of 6
  129. Echo.
  130. Echo Starting Install...
  131. Echo.
  132. Echo Should take about 15min; reboot if machine hangs.
  133. Echo.
  134. Echo If the installer prompts for reboot just hit CLOSE^^!
  135. Echo.
  136. Start /wait C:\Win7qUD\2nd.msu /quiet
  137. shutdown /r /t 60 /c "Rebooting: Process will continue after restart."
  138. @echo 64step5 > C:\Step.txt
  139. exit
  140.  
  141. :64step5
  142. @echo 64step5 > C:\Step.txt
  143. :: Installing third MSU
  144. cls
  145. Echo.
  146. Echo Step 5 of 6
  147. Echo.
  148. Echo Starting Install...
  149. Echo.
  150. Echo Should take about 35min; reboot if machine hangs.
  151. Echo.
  152. Echo If the installer prompts for reboot just hit CLOSE^^!
  153. Echo.
  154. Echo To check to see if its working "TrustedInstaller" should be going nuts.
  155. Start /wait C:\Win7qUD\3rd.msu /quiet
  156. shutdown /r /t 60 /c "Rebooting: Process will continue after restart."
  157. @echo 64step6 > C:\Step.txt
  158. exit
  159.  
  160. :64step6
  161. Echo.
  162. :: Cleaning up files etc
  163. cls
  164. rmdir C:\Win7qUD /s /q
  165. del C:\Step.txt
  166. Echo.
  167. Echo Step 6 of 6
  168. Echo.
  169. Echo Complete^^!
  170. Echo.
  171. Echo You should now be able to continue Windows updates as normal.
  172. Echo.
  173. Echo You can delete this script after it closes if you wish.
  174. Echo.
  175. Echo This script will now delete itself from startup.
  176. Echo.
  177. pause
  178. del "%USERPROFILE%\Start Menu\Programs\Startup\*.bat"
  179. goto exit
  180.  
  181. :32BIT
  182. goto 32step1
  183.  
  184. :32step1
  185. @echo 32step1 > C:\Step.txt
  186. :: Kill Services and folders
  187. cls
  188. Echo.
  189. Echo Step 1 of 6
  190. Echo.
  191. Echo Killing Services etc
  192. SC stop wuauserv
  193. rmdir c:\windows\softwaredistribution\WuRedir /s /q
  194.  
  195.  
  196. :32step2
  197. @echo 32step2 > C:\Step.txt
  198. :: Download KB fixes x86
  199. cls
  200. echo.
  201. Echo Step 2 of 6
  202. Echo.
  203. Echo Downloading KB updates.
  204. Echo.
  205. 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
  206. 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
  207. 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
  208.  
  209. :32step3
  210. @echo 32step3 > C:\Step.txt
  211. :: Installing first MSU
  212. cls
  213. Echo.
  214. Echo Step 3 of 6
  215. Echo.
  216. Echo Starting Install...
  217. Echo.
  218. Echo Should take about 15min; reboot if machine hangs.
  219. Echo.
  220. Echo If the installer prompts for reboot just hit CLOSE^^!
  221. Echo.
  222. Start /wait C:\Win7qUD\1st.msu /quiet
  223. shutdown /r /t 60 /c "Rebooting: Process will continue after restart."
  224. @echo 32step4 > C:\Step.txt
  225. exit
  226.  
  227. :32step4
  228. @echo 32step4 > C:\Step.txt
  229. :: Installing second MSU
  230. cls
  231. Echo.
  232. Echo Step 4 of 6
  233. Echo.
  234. Echo Starting Install...
  235. Echo.
  236. Echo Should take about 15min; reboot if machine hangs.
  237. Echo.
  238. Echo If the installer prompts for reboot just hit CLOSE^^!
  239. Echo.
  240. Start /wait C:\Win7qUD\2nd.msu /quiet
  241. shutdown /r /t 60 /c "Rebooting: Process will continue after restart."
  242. @echo 32step5 > C:\Step.txt
  243. exit
  244.  
  245. :32step5
  246. @echo 32step5 > C:\Step.txt
  247. :: Installing third MSU
  248. cls
  249. Echo.
  250. Echo Step 5 of 6
  251. Echo.
  252. Echo Starting Install...
  253. Echo.
  254. Echo Should take about 35min; reboot if machine hangs.
  255. Echo.
  256. Echo If the installer prompts for reboot just hit CLOSE^^!
  257. Echo.
  258. Echo To check to see if its working "TrustedInstaller" should be going nuts.
  259. Start /wait C:\Win7qUD\3rd.msu /quiet
  260. shutdown /r /t 60 /c "Rebooting: Process will continue after restart."
  261. @echo 32step6 > C:\Step.txt
  262. exit
  263.  
  264. :32step6
  265. Echo.
  266. :: Cleaning up files etc
  267. cls
  268. rmdir C:\Win7qUD /s /q
  269. del C:\Step.txt
  270. echo.
  271. Echo Step 6 of 6
  272. Echo.
  273. Echo Complete^^!
  274. Echo.
  275. Echo You should now be able to continue Windows updates as normal.
  276. Echo.
  277. Echo You can delete this script after it closes if you wish.
  278. Echo.
  279. Echo This script will now delete itself from startup.
  280. Echo.
  281. pause
  282. del "%USERPROFILE%\Start Menu\Programs\Startup\*.bat"
  283. goto exit
  284.  
  285. :exit
  286. rmdir C:\Win7qUD /s /q
  287. del C:\Step.txt
  288. exit
  289.  
  290. ::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