如題
手邊有兩個批次檔
**請問有辦法透過 A) 檢查
Not install 的再接著 B) 進行安裝嗎?**
舉例A)的Patch_list.txt 要看是否有這三支
KB4034679
KB4048690
KB4054521
假設其中 not install 的是KB4054521
再給B)的批次進行安裝
還是A) 的 not install 直接改成進行安裝 而非秀出 ECHO not install
**A)檢查是否安裝清單中的hotfix**
```
@ECHO OFF
WMIC QFE GET HOTFIXID>%~dp0QFE_list.txt
FOR /f %%a IN (%~dp0Patch_List.txt) DO (
CALL :PATCH_LIST %%a
)
GOTO :EOF
:PATCH_LIST
REG QUERY "HKLMSOFTWAREMicrosoftWindowsCurrentVersionUninstall" /s /f "%1">NUL
L.txt
IF %ERRORLEVEL% EQU 0 ECHO %1: INSTALLED
IF %ERRORLEVEL% NEQ 0 (
ECHO FIND %1
FIND /C "%1" %~dp0QFE_List.txt>NULL.txt
IF ERRORLEVEL 0 ECHO %1: QFE INSTALLED
IF ERRORLEVEL 1 ECHO %1: **** NOT INSTALLED! ****
)
```
**B)一次批次安裝目錄中所有 msu更新檔**
```
@echo off
CLS
TITLE WINDOWS UPDATE INSTALLER!
echo.
echo Getting Ready Windows Update
echo Installing Windows Updates...
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
FOR /R "%~dp0" %%A IN (*.MSU) DO (
ECHO= Installing %%~nA
>NUL TIMEOUT /t 3
WUSA "%%A" /quiet /norestart)
echo Done!
```