Windows 更新程式 - 檔案內容和版本檢查



贊助商連結


琥珀
2009-05-01, 12:14 AM
範例是給 Windows XP 系統用的。



@echo off

for %%z in (*XP-KB*.exe) do %%z /x:%%~nz /q

for /f %%v in ('dir /ad /b *XP-KB*') do (
cd %%v
for /f %%t in ('dir /ad /b *3Q*') do (
cd %%t
for /f "tokens=2 delims=-" %%n in ("%%v") do (
echo %%n
echo %%n>>..\..\vcheck.txt
echo ========================================>>..\..\vcheck.txt
for /r %%f in (*) do echo %%~nxf>>..\..\vcheck.txt&sigcheck -q -n %%f>>..\..\vcheck.txt
echo.>>..\..\vcheck.txt
)
cd ..
)
cd ..
)

for /f %%a in ('dir /ad /b *XP-KB*') do rd /s /q %%a

贊助商連結


琥珀
2010-07-04, 06:49 PM
全新撰寫的腳本。經過兩天的實驗,應該是可以應付目前的 XP SP3 更新檔。



@echo off

set file1=fileinfo.txt
set file2=filelist.txt

del %file1% %file2% 2>nul

for %%f in (WindowsXP-KB*.exe) do (
for /f "tokens=2 delims=-" %%r in ("%%f") do (
echo %%r
if not exist %%r %%f /q /x:%%r

cd %%r
for %%x in (empty.cat spmsg.dll spuninst.exe spupdsvc.exe tzchange.dll) do del %%x 2>nul
for %%v in (SP3GDR\* SP3QFE\* SP3QFE\ip\* SP3QFE\lang\* wm9\*) do move %%v
for /f "delims=" %%s in ('dir /a-d /b /s SP3GDR SP3QFE ^2^>nul') do move "%%s"
for /d %%d in (*) do rd /q /s %%d
cd ..

echo %%r>>%file1%
echo ========================================>>%file1%

for %%n in (%%r\*) do (
echo %%~nxn>>%file1%
sigcheck -n -q %%n>>%file1%
echo.>>%file1%
)

xcopy /d /k /q /y %%r FILES\
echo.
)
)

for %%n in (FILES\*) do (
echo %%~nxn>>%file2%
sigcheck -n -q %%n>>%file2%
echo.>>%file2%
)

set file1=
set file2=

琥珀
2011-07-22, 11:53 PM
為了加速 Windows XP 更新彙總的製作過程,腳本又改寫了一次。



@echo off & setlocal enabledelayedexpansion

set "dir1=rtmgdr" & set "dir2=rtmqfe" & set "file1=fileinfo.txt" & set "file2=filelist.txt"
del %file1% %file2% 2>nul

for %%f in (windows*.exe) do for /f "tokens=2 delims=-" %%r in ("%%f") do (
echo %%r
if not exist %%r %%f /q /x:%%r

cd %%r
del empty.cat spmsg.dll spuninst.exe spupdsvc.exe tapicust.dll tzchange.dll 2>nul
for /l %%i in (1,1,3) do if exist sp%%iqfe\ set "dir1=sp%%igdr" & set "dir2=sp%%iqfe"
for %%s in (!dir1!\* !dir2!\* !dir2!\ip\* uniproc\* wm41\* wm8\* wm9\*) do move "%%s"
for %%v in (asms lang) do xcopy /d /e /k /q /y !dir2!\%%v %%v\ 1>nul 2>&1
rd /q /s rtmgdr rtmqfe sp1gdr sp1qfe sp2gdr sp2qfe sp3gdr sp3qfe uniproc 2>nul
rd /q /s mceur2 v8dme wm41 wm8 wm9 wm10 wm10l wm10mix wm11 2>nul
rd /q /s update 2>nul
cd ..

echo %%r>>%file1%
echo ========================================>>%file1%

for /f "delims=" %%n in ('dir /a-d /b /s %%r ^2^>nul') do (
echo %%~nxn>>%file1%
sigcheck -n -q "%%n">>%file1%
echo.>>%file1%
)

xcopy /d /e /k /q /y %%r qfe\
echo.
)

for /f "delims=" %%n in ('dir /a-d /b /s qfe ^2^>nul') do (
echo %%~nxn>>%file2%
sigcheck -n -q "%%n">>%file2%
echo.>>%file2%
)