1、关于%windir%\SoftwareDistribution\Download目录下Windows Update自动下载的补丁的重利用批处理
|
@echo off set opt=/passive /norestart /overwriteoem /nobackup for /d %%d in (*) do call :_upit %%d echo. echo !!!ATTENTION!!!: All update done! Press any key to reboot… pause >nul shutdown -r -f -t 0 goto :eof
:_upit echo Patching %1… if exist %1\update\update.exe start /wait %1\update\update.exe %opt% echo %1 done! echo. goto :eof
|
2、根据超级巡警导出补丁列表文件PatchList.txt的内容自动运行相应补丁的批处理
2.1 PatchList.txt范例:
2.2 GetFileList.cmd: 从PatchList.txt文件中提取补丁文件名
|
@echo off for /f "usebackq tokens=2,3,4,5,6,7,8,9,10,11,12 delims=/" %%a in (`type PatchList.txt ^| find "://"`) do call :_check %%a %%b %%c %%d %%e %%f %%g %%h %%i %%j %%k set tmpvar= set lastvar=
goto :eof
:_check set tmpvar= set lastvar=
:_loop set tmpvar=%1 if not defined tmpvar echo %lastvar% if not defined tmpvar goto :eof set lastvar=%tmpvar% shift goto _loop
|
2.3 Go.cmd : 根据2.2中提取的文件名打补丁的批处理
|
@echo off if not "%1"=="" goto _man
:_auto for /f %%i in (’dir /b/od *.exe’) do call :_update %%i goto _all_done
:_man if not exist %1 goto _auto for /f %%i in (%1) do call :_update %%i goto _all_done
:_update if not exist %1 echo !!!File %1 not exist!!! && goto :eof echo Running %1 … set filename=%1 set _wait=/wait if /i not "%filename:~0,3%"=="win" set _wait= start %_wait% %1 /quiet /passive /norestart /overwriteoem /nobackup echo %1 done! echo. goto :eof
:_all_done echo 补丁全部打完,按任意键重新启动计算机… pause >nul shutdown -r -f -t 0 goto :eof
|