1 @echo off
2 color 0a
3 title Prerequisite updates for Internet Explorer 11
4
5 SETLOCAL ENABLEEXTENSIONS
6 SETLOCAL ENABLEDELAYEDEXPANSION
7
8 set CONFIG_ORIGIN=config.ini
9 set CONFIG_SWAP=.config.swp
10
11 set /a TYPE=64
12 if "%ProgramFiles(x86)%" equ "" (
13 set /a TYPE=32
14 )
15
16 choice /c "Yn" /cs /m "Install Prerequisite updates."
17 set /a PREREQUISITE=-1
18 if %ERRORLEVEL% equ 1 (
19 set /a PREREQUISITE=0
20 )
21
22 choice /c "Yn" /cs /m "Install Optional updates."
23 set /a OPTIONAL=-1
24 if %ERRORLEVEL% equ 1 (
25 set /a OPTIONAL=0
26 )
27
28 if %PREREQUISITE% neq 0 (
29 if %OPTIONAL% neq 0 (
30 goto :BYE
31 )
32 )
33
34 cls
35 echo. System type: %TYPE%-bit
36 if %PREREQUISITE% equ 0 (
37 echo. Install Prerequisite updates.
38 )
39 if %OPTIONAL% equ 0 (
40 echo. Install Optional updates.
41 )
42
43 choice /c "Yn" /cs /m "Are you ready?"
44 if %ERRORLEVEL% neq 1 (
45 goto :BYE
46 )
47
48 cls
49 set /a TOTAL_INSTALL=0
50 if %PREREQUISITE% equ 0 (
51 echo. Installing: Prerequisite updates.
52 call :PROC_INSTALL "[PREREQUISITE_UPDATES_%TYPE%]"
53 )
54 if %OPTIONAL% equ 0 (
55 echo. Installing: Optional updates.
56 call :PROC_INSTALL "[OPTIONAL_UPDATES_%TYPE%]"
57 )
58
59 :COMPLETED
60 rem cls
61 if %TOTAL_INSTALL% gtr 0 (
62 echo. Installation complete.
63 echo. You must restart your computer for the updates to take effect.
64 choice /c "Yn" /cs /m "Restart Now?"
65 if !ERRORLEVEL! equ 1 (
66 if exist "%CONFIG_SWAP%" (
67 del /q "%CONFIG_SWAP%"
68 )
69 shutdown /r /t 0
70 exit
71 )
72 ) else (
73 echo. No updates installed.
74 )
75 goto :BYE
76
77 :PROC_INSTALL
78 set CONFIG_LABEL=%~1
79
80 cd . > "%CONFIG_SWAP%"
81
82 for /f "usebackq eol=# tokens=*" %%i in ("%CONFIG_ORIGIN%") do (
83 >> "%CONFIG_SWAP%" echo %%i
84 )
85
86 set /a LINE_NUMBER=0
87 for /f "usebackq tokens=*" %%i in ("%CONFIG_SWAP%") do (
88 set /a LINE_NUMBER+=1
89 if "%%i" equ "%CONFIG_LABEL%" (
90 call :INSTALL_PART_2
91 goto :EOF
92 )
93 )
94 echo. Not found %CONFIG_LABEL%.
95 goto :EOF
96
97 :INSTALL_PART_2
98 for /f "usebackq skip=%LINE_NUMBER% tokens=*" %%i in ("%CONFIG_SWAP%") do (
99 set CURRENT=%%i
100 if "!CURRENT:~0,1!" equ "[" (
101 goto :EOF
102 )
103 echo Installing [%%i].
104 wusa "%%i" /quiet /norestart
105 set /a TOTAL_INSTALL+=1
106 )
107 goto :EOF
108
109 :BYE
110 echo. Goodbye!
111 ping /n 3 127.0.0.1 > nul
112 if exist "%CONFIG_SWAP%" (
113 del /q "%CONFIG_SWAP%"
114 )
115 exit
1 # Prerequisite updates 32-bit
2 [PREREQUISITE_UPDATES_32]
3 Prerequisite updateswindows6.1-kb2533623-x86.msu
4 Prerequisite updateswindows6.1-kb2670838-x86.msu
5 Prerequisite updateswindows6.1-kb2729094-v2-x86.msu
6 Prerequisite updateswindows6.1-kb2731771-x86.msu
7 Prerequisite updateswindows6.1-kb2786081-x86.msu
8 Prerequisite updateswindows6.1-kb2834140-v2-x86.msu
9
10 # Prerequisite updates 64-bit
11 [PREREQUISITE_UPDATES_64]
12 Prerequisite updateswindows6.1-kb2533623-x64.msu
13 Prerequisite updateswindows6.1-kb2670838-x64.msu
14 Prerequisite updateswindows6.1-kb2729094-v2-x64.msu
15 Prerequisite updateswindows6.1-kb2731771-x64.msu
16 Prerequisite updateswindows6.1-kb2786081-x64.msu
17 Prerequisite updateswindows6.1-kb2834140-v2-x64.msu
18
19 # Optional updates 32-bit
20 [OPTIONAL_UPDATES_32]
21 Optional updateswindows6.1-kb2639308-x86.msu
22 Optional updateswindows6.1-kb2882822-x86.msu
23 Optional updateswindows6.1-kb2888049-x86.msu
24
25 # Optional updates 64-bit
26 [OPTIONAL_UPDATES_64]
27 Optional updateswindows6.1-kb2639308-x64.msu
28 Optional updateswindows6.1-kb2882822-x64.msu
29 Optional updateswindows6.1-kb2888049-x64.msu
附件1