win7打补丁- @echo off
- del list.log /q
- dir *-kb*.msu /b /o:n >a.txt
- ::wmic qfe get hotfixid >>1.txt
- for /f "tokens=2" %%a in ('systeminfo^|findstr /i "kb"') do echo %%a>>1.txt
- for /f "delims=^- tokens=1,*" %%a in (1.txt) do (echo %%a>>2.txt)
- del 1.txt /q
- for /f "delims=^_ tokens=1,*" %%a in (2.txt) do (echo %%a>>b.txt)
- del 2.txt /q
- findstr /V /I /G:b.txt a.txt > c.txt && move /y c.txt list.log
- del *.txt
- for /f "eol=o eol=O " %%j in (list.log) do echo 正在安装补丁%%j && start /wait wusa %%j /quiet /norestart
复制代码 xp打补丁- @echo off
- del list.log /q
- dir *-kb*.exe /b /o:n >a.txt
- ::wmic qfe get hotfixid >>1.txt
- for /f "tokens=2" %%a in ('systeminfo^|findstr /i "kb"') do echo %%a>>1.txt
- for /f "delims=^- tokens=1,*" %%a in (1.txt) do (echo %%a>>2.txt)
- del 1.txt /q
- for /f "delims=^_ tokens=1,*" %%a in (2.txt) do (echo %%a>>b.txt)
- del 2.txt /q
- findstr /V /I /G:b.txt a.txt > c.txt && move /y c.txt list.log
- del *.txt
- for /f "eol=o eol=O " %%j in (list.log) do echo 正在安装补丁%%j && %%j /quiet /norestart
复制代码 如果使用注释掉的方法获取已安装补丁,后面就无法完成
可能wmic进入了交互环境
无法退出。 |