|
zh159
金牌会员
     
积分 3687
发帖 1467
注册 2005-8-8
状态 离线
|
『楼 主』:
[原创]XP 补丁自动安装
使用 LLM 解释/回答一下
放在补丁目录下运行,可以自动判断已安装的补丁并跳过(不用生成临时文件,跳过的速度比用findstr查找临时列表的速度快多了),其他请看文件说明
麻烦会查找其他补丁安装后注册位置的DX提个醒
请自行将{TAB}改为制表符(键盘TAB键)
::XP 补丁自动安装 - code zh159@bbs.cn-dos.net 2007-12-6
::本 XP 补丁安装目前只能自动安装 /q /z /o 参数,
::并在 注册的 XP 补丁,
::其余的自行修改。【XP 补丁文件名称为下载的原始名称】
@echo off
title XP 补丁安装
echo.
echo. 获取系统已安装补丁列表,请稍等. . .
echo.
for /f "tokens=7 delims=\" %%i in ('reg query "HKLM\SOFTWARE\Microsoft\windows nt\Currentversion\Hotfix"^|findstr /i "kb"') do (
set "str=%%i"
call set "☉%%str:~0,8%%= "
set /a Num+=1
call set/p= 系统已安装 %%Num%% 个补丁。<nul
set /p=<nul
)
echo.&echo.
set Num=0
for /f "delims=" %%i in ('dir/b/on *KB*.exe 2^>nul') do (
for /f "tokens=2 delims=-" %%n in ("%%i") do set "⊕%%n=%%i"
set /a Num+=1
call set/p= 当前目录下有 %%Num%% 个补丁。<nul
set /p=<nul
)
if %Num% == 0 echo. 当前目录没有 XP 补丁文件!请按任意键退出程序。&pause>nul&exit
echo.&echo.
set Num=0
echo. 是否开始装补丁?
set /p YN= (直接回车开始安装/显示系统已安装补丁列表/退出):
if /i "%YN%" == "X" exit
if /i "%YN%" == "L" (
echo.
for /f "delims=☉=" %%i in ('set ☉') do (
set /a Num+=1
call set "List= %%Num%%. "
call set "List=%%List:~-6%%"
call set/p=%%List%%%%i{TAB}<nul
)
echo.&echo.&echo. 请按任意键继续安装补丁. . .&pause>nul
)
echo.
echo. 开始安装补丁. . .
echo.
set Num=0
set New=0
for /f "tokens=1,2* delims=⊕=" %%n in ('set ⊕') do (
set /a Num+=1
if defined ☉%%n (
call echo. %%Num%%.{TAB}%%o 补丁已安装。
) else (
set /a New+=1
call echo. %%Num%%.{TAB}%%o 补丁开始安装,请稍等. . .
call %%o /q /z /o
)
)
echo.
echo 补丁安装完毕,本次安装新补丁 %New% 个!
pause>nul
exit
Last edited by zh159 on 2007-12-7 at 12:36 AM ]
Place it in the patch directory and run it. It can automatically judge the installed patches and skip them (no temporary files are generated, and the skipping speed is much faster than using findstr to search the temporary list). For other details, please refer to the file instructions
Troubleshooters who can find the registration locations of other patched installations, please give a heads-up
Please change {TAB} to the tab key (keyboard TAB key)
::XP Patch Automatic Installation - code zh159@bbs.cn-dos.net 2007-12-6
::This current XP patch installation can only automatically install parameters /q /z /o,
::and XP patches registered in ,
::the rest are modified by yourself.
@echo off
title XP Patch Installation
echo.
echo. Getting the list of installed patches on the system, please wait...
echo.
for /f "tokens=7 delims=\" %%i in ('reg query "HKLM\SOFTWARE\Microsoft\windows nt\Currentversion\Hotfix"^|findstr /i "kb"') do (
set "str=%%i"
call set "☉%%str:~0,8%%= "
set /a Num+=1
call set/p= There are %%Num%% patches installed on the system. <nul
set /p=<nul
)
echo.&echo.
set Num=0
for /f "delims=" %%i in ('dir/b/on *KB*.exe 2^>nul') do (
for /f "tokens=2 delims=-" %%n in ("%%i") do set "⊕%%n=%%i"
set /a Num+=1
call set/p= There are %%Num%% patches in the current directory. <nul
set /p=<nul
)
if %Num% == 0 echo. There are no XP patch files in the current directory! Press any key to exit the program. &pause>nul&exit
echo.&echo.
set Num=0
echo. Do you want to start installing patches?
set /p YN= ( directly press Enter to start installation/ display the list of installed patches on the system/ exit):
if /i "%YN%" == "X" exit
if /i "%YN%" == "L" (
echo.
for /f "delims=☉=" %%i in ('set ☉') do (
set /a Num+=1
call set "List= %%Num%%. "
call set "List=%%List:~-6%%"
call set/p=%%List%%%%i{TAB}<nul
)
echo.&echo.&echo. Please press any key to continue installing patches... &pause>nul
)
echo.
echo. Starting to install patches...
echo.
set Num=0
set New=0
for /f "tokens=1,2* delims=⊕=" %%n in ('set ⊕') do (
set /a Num+=1
if defined ☉%%n (
call echo. %%Num%%.{TAB}%%o Patch has been installed.
) else (
set /a New+=1
call echo. %%Num%%.{TAB}%%o Patch starts to install, please wait...
call %%o /q /z /o
)
)
echo.
echo Patch installation is complete, %New% new patches were installed this time!
pause>nul
exit
Last edited by zh159 on 2007-12-7 at 12:36 AM ]
|

 |
|
2007-12-7 00:32 |
|
|
vkill
金牌会员
     
积分 4103
发帖 1744
注册 2006-1-20 来自 甘肃.临泽
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
我想在p后面最好附个 补丁的安装参数 ,这样p更完美
I want to attach the installation parameters of the patch after p, so that p is more perfect
|
|
2007-12-7 01:02 |
|
|
vkill
金牌会员
     
积分 4103
发帖 1744
注册 2006-1-20 来自 甘肃.临泽
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
以前写的,觉得用处不大就没有发帖子出来
@echo off
title windows xp/2003自动更新 V:1.2 by:vkill
::详细信息查看http://www.vkill.net/cmd-life/p-SystemAutoUpdate.html
::需要 wget.exe / sed.exe / ConCmd.rar(ConCmd.exe ConCmd.ini gbfix.dat B5fix.dat) 文件,请到http://www.vkill.net/tools.html下载
::config:::::::::::::::::::::
::可修改参数,开始日期指查找所有本日期后发布的更新,开始日期优先于发行日期
set "开始日期=4/1/2007"
set "发行日期=90"
set "t=test.t"
::下面为不可修改的参数如修改请查看http://www.microsoft.com/downloads/advancedsearch.aspx?displaylang=zh-cn
set "关键字="
set "产品/技术="
set "类别=7"
set "结果排序方式=date"
set "每页显示结果数=50"
set "语言=zh-cn"
set "是否显E文=on"
set "url=http://www.microsoft.com/downloads/"
::start::::::::::::::::::::::::::::::
::当加参数 /update_code 运行本程序时将自动升级
set "o=%~0"
if "%~1"=="/update_code" (call :update_code & exit /b)
if exist 需安装补丁.txt (
echo 上次未更新完,继续上次开始更新,6秒后自动开始
ping -n 6 127.1 >nul 2>nul
goto down_and_install_up
)
set "关键字="
ver|find "5.1" >nul 2>nul &&(set "关键字=xp")
ver|find "5.2" >nul 2>nul &&(set "关键字=2003")
if not defined 关键字 (echo 本程序只支持xp/2003系统,6秒后退出&ping -n 6 127.1 >nul 2>nul&goto :eof)
for /f "tokens=2 delims=" %%? in ('ping -n 1 www.microsoft.com ^|findstr /i "^ping.*"') do (set "ip=%%?")
if not defined ip (echo 连接不到microsoft.com,6秒后退出&ping -n 6 127.1 >nul 2>nul&goto :eof)
echo 查找需安装补丁中,请稍候......
md "%t%" >nul 2>nul
pushd "%t%"
del /f/q *.* >nul 2>nul
for /f "tokens=*" %%? in ('echo %开始日期%^|sed -r "s/\/|\-|\./%%2f/g"') do (set "开始日期=%%?")
set "url_downi=%url%results.aspx?startdate=%开始日期%&freetext=%关键字%&productID=%产品/技术%&categoryId=%类别%&period=%发行日期%&sortCriteria=%结果排序方式%&nr=%每页显示结果数%&DisplayLang=%语言%&DisplayEnglishAlso=%是否显E文%"
set n=0
:loop_down_i
set/a n+=1
wget -q -O "index.txt" "%url_downi%"
ConCmd.exe /i:utf8 /o:gbk /q "index.txt" "i_%n%.txt"
findstr ">下一个" "i_%n%.txt" >nul 2>nul &&(
for /f "tokens=*" %%? in ('sed -r "/>下一个/!d;s/.*<a href=\x22(*)\x22>.*/\1/;s/amp;//g" "i_%n%.txt"') do (set "url_downi=%url%%%?")
goto loop_down_i
)
::loop_down_i end
for /l %%? in (1,1,%n%) do (
sed -r "/?KB{6}?<\/a>/!d;s/.*(<a href=\x22)(*)(\x22>)(.*)?(KB{6})?(<\/a>).*/\5,\4,\2/;s/amp;//g" "i_%%?.txt"|more>>"liebiao.txt"
)
::过滤x86 /x64
copy liebiao.txt liebiao_l.txt >nul 2>nul
if "%PROCESSOR_ARCHITECTURE%"=="x86" (findstr /V "x64" liebiao_l.txt >liebiao.txt 2>nul)
if "%PROCESSOR_ARCHITECTURE%"=="x64" (findstr /V "x86" liebiao_l.txt >liebiao.txt 2>nul)
::找到需更新文件的绝对下载地址
cd.>downpage.txt
for /f "tokens=1,2,3 delims=," %%a in ('type "liebiao.txt"') do (
del /f/q "t_*.txt" >nul 2>nul
wget -q -O "t_u.txt" "%url%%%c"
ConCmd.exe /i:utf8 /o:gbk /q "t_u.txt" "t_g.txt"
sed -r "/value=\x22(下载|Download)\x22><\/form>/!d;s/.*\{window.open*'(*)',.*/%%a,%%b,\1/" "t_g.txt"|more>>"downpage.txt"
)
for /f "tokens=*" %%? in ('systeminfo^|sed -r "/KB{6}/!d;s/.*(KB{6}).*/\1/"') do (>>"已安装补丁.txt" echo %%?)
findstr /B /V /G:"已安装补丁.txt" "downpage.txt" >"..\需安装补丁.txt" 2>nul
popd
:down_and_install_up
mode con cols=100 lines=30
echo -----windows xp/2003 自动更新-----
echo.
echo 需要安装补丁列表如下:
echo ________________________________________________________________________________
for /f "tokens=1,2,3 delims=," %%a in ('type "需安装补丁.txt"') do (echo "%%a,%%b")
echo ________________________________________________________________________________
for /f "tokens=1,2,3 delims=," %%a in ('type "需安装补丁.txt"') do (
echo "%%a,%%b" 补丁
echo 下载中,请稍候......
wget -c -q -O "%%~nxc" "%%c"
echo 安装中,请稍候......
::微软补丁自动化安装参数见最下面的 附-
"%%~nxc" /passive /norestart /u /o /z /q
)
echo 所有补丁安装完毕,6秒后退出&ping -n 6 127.1>nul 2>nul
del /f/q 需安装补丁.txt>nul 2>nul
goto :eof
:update_code
setlocal ENABLEDELAYEDEXPANSION
::最后更新
md "%t%" >nul 2>nul
pushd "%t%"
del /f/q *.*>nul 2>nul
wget -q -O "i.txt" "http://www.vkill.net/cmd-life/p-SystemAutoUpdate.html"
for /f "tokens=1 delims=:" %%? in ('findstr /N "^<TEXTAREA" "i.txt"') do (more +%%? i.txt>"a")
for /f "tokens=1 delims=:" %%? in ('findstr /N "^<\/TEXTAREA>" "i.txt"') do (set/a "a=%%?-1" & more +!a! i.txt>"b")
findstr /V /B /E /G:"b" "a">"c"
for /f "tokens=2 delims=" %%? in ('findstr "^::最后更新\" "%o%"') do (set "lastupdate_l=%%?")
if not defined lastupdate_l (set "lastupdate_l=06/06/2007")
for /f "tokens=2 delims=" %%? in ('findstr "^::最后更新\" "c"') do (set "lastupdate_n=%%?")
if "%lastupdate_l%" lss "%lastupdate_n%" (
echo 检测到新版本,任意键开始更新,更新完成后会自动退出程序,请重新运行
pause>nul
copy "c" "%o%"
) else (echo 本程序当前为最新版本,任意键退出&pause>nul)
goto :eof
::附-微软补丁自动化安装命令:::::::::::::::::::
*.exe /passive /norestart 参数
-u 无人参与模式
-f 强迫其它程序在关机时关闭
-n 不要为卸载备份文件
-o 不提示覆盖OEM文件
-z 安装完成后不要重新启动
-q 安装模式(无需用户参与)
-l 列出已经安装的补丁程序
-s:<dir> 将Service Pack文件集成到<dir>路径
-d:<dir> 文件备份到<dir>路径
::::::::::::::::::::::::::::::::::::::::::::::
::
Written before, I thought it was not useful, so I didn't post it out
@echo off
title windows xp/2003 Automatic Update V:1.2 by:vkill
::For detailed information, please view http://www.vkill.net/cmd-life/p-SystemAutoUpdate.html
::Requires wget.exe / sed.exe / ConCmd.rar(ConCmd.exe ConCmd.ini gbfix.dat B5fix.dat) files. Please download from http://www.vkill.net/tools.html
::config:::::::::::::::::::::
::Modifiable parameters. The start date refers to finding all updates released after this date. The start date has priority over the release date
set "start_date=4/1/2007"
set "release_date=90"
set "t=test.t"
::The following are non-modifiable parameters. If modified, please view http://www.microsoft.com/downloads/advancedsearch.aspx?displaylang=zh-cn
set "keyword="
set "product/technology="
set "category=7"
set "result_sorting_method=date"
set "results_per_page=50"
set "language=zh-cn"
set "show_english=on"
set "url=http://www.microsoft.com/downloads/"
::start::::::::::::::::::::::::::::::
::When running this program with parameter /update_code, it will automatically update
set "o=%~0"
if "%~1"=="/update_code" (call :update_code & exit /b)
if exist 需安装补丁.txt (
echo Last update not completed, continue to update from last time. It will automatically start after 6 seconds
ping -n 6 127.1 >nul 2>nul
goto down_and_install_up
)
set "keyword="
ver|find "5.1" >nul 2>nul &&(set "keyword=xp")
ver|find "5.2" >nul 2>nul &&(set "keyword=2003")
if not defined keyword (echo This program only supports xp/2003 systems. It will exit after 6 seconds&ping -n 6 127.1 >nul 2>nul&goto :eof)
for /f "tokens=2 delims=" %%? in ('ping -n 1 www.microsoft.com ^|findstr /i "^ping.*"') do (set "ip=%%?")
if not defined ip (echo Cannot connect to microsoft.com. It will exit after 6 seconds&ping -n 6 127.1 >nul 2>nul&goto :eof)
echo Searching for patches to install, please wait......
md "%t%" >nul 2>nul
pushd "%t%"
del /f/q *.* >nul 2>nul
for /f "tokens=*" %%? in ('echo %start_date%^|sed -r "s/\/|\-|\./%%2f/g"') do (set "start_date=%%?")
set "url_downi=%url%results.aspx?startdate=%start_date%&freetext=%keyword%&productID=%product/technology%&categoryId=%category%&period=%release_date%&sortCriteria=%result_sorting_method%&nr=%results_per_page%&DisplayLang=%language%&DisplayEnglishAlso=%show_english%"
set n=0
:loop_down_i
set/a n+=1
wget -q -O "index.txt" "%url_downi%"
ConCmd.exe /i:utf8 /o:gbk /q "index.txt" "i_%n%.txt"
findstr ">Next" "i_%n%.txt" >nul 2>nul &&(
for /f "tokens=*" %%? in ('sed -r "/>Next/!d;s/.*<a href=\x22(*)\x22>.*/\1/;s/amp;//g" "i_%n%.txt"') do (set "url_downi=%url%%%?")
goto loop_down_i
)
::loop_down_i end
for /l %%? in (1,1,%n%) do (
sed -r "/?KB{6}?<\/a>/!d;s/.*(<a href=\x22)(*)(\x22>)(.*)?(KB{6})?(<\/a>).*/\5,\4,\2/;s/amp;//g" "i_%%?.txt"|more>>"liebiao.txt"
)
::Filter x86 /x64
copy liebiao.txt liebiao_l.txt >nul 2>nul
if "%PROCESSOR_ARCHITECTURE%"=="x86" (findstr /V "x64" liebiao_l.txt >liebiao.txt 2>nul)
if "%PROCESSOR_ARCHITECTURE%"=="x64" (findstr /V "x86" liebiao_l.txt >liebiao.txt 2>nul)
::Find the absolute download address of the file to be updated
cd.>downpage.txt
for /f "tokens=1,2,3 delims=," %%a in ('type "liebiao.txt"') do (
del /f/q "t_*.txt" >nul 2>nul
wget -q -O "t_u.txt" "%url%%%c"
ConCmd.exe /i:utf8 /o:gbk /q "t_u.txt" "t_g.txt"
sed -r "/value=\x22(Download|Download)\x22><\/form>/!d;s/.*\{window.open*'(*)',.*/%%a,%%b,\1/" "t_g.txt"|more>>"downpage.txt"
)
for /f "tokens=*" %%? in ('systeminfo^|sed -r "/KB{6}/!d;s/.*(KB{6}).*/\1/"') do (>>"已安装补丁.txt" echo %%?)
findstr /B /V /G:"已安装补丁.txt" "downpage.txt" >"..\需安装补丁.txt" 2>nul
popd
:down_and_install_up
mode con cols=100 lines=30
echo -----windows xp/2003 Automatic Update-----
echo.
echo The list of patches to be installed is as follows:
echo ________________________________________________________________________________
for /f "tokens=1,2,3 delims=," %%a in ('type "需安装补丁.txt"') do (echo "%%a,%%b")
echo ________________________________________________________________________________
for /f "tokens=1,2,3 delims=," %%a in ('type "需安装补丁.txt"') do (
echo "%%a,%%b" Patch
echo Downloading, please wait......
wget -c -q -O "%%~nxc" "%%c"
echo Installing, please wait......
::For parameters of Microsoft patch automatic installation, see the bottom - attached -
"%%~nxc" /passive /norestart /u /o /z /q
)
echo All patches have been installed. It will exit after 6 seconds&ping -n 6 127.1>nul 2>nul
del /f/q 需安装补丁.txt>nul 2>nul
goto :eof
:update_code
setlocal ENABLEDELAYEDEXPANSION
::Last update
md "%t%" >nul 2>nul
pushd "%t%"
del /f/q *.*>nul 2>nul
wget -q -O "i.txt" "http://www.vkill.net/cmd-life/p-SystemAutoUpdate.html"
for /f "tokens=1 delims=:" %%? in ('findstr /N "^<TEXTAREA" "i.txt"') do (more +%%? i.txt>"a")
for /f "tokens=1 delims=:" %%? in ('findstr /N "^<\/TEXTAREA>" "i.txt"') do (set/a "a=%%?-1" & more +!a! i.txt>"b")
findstr /V /B /E /G:"b" "a">"c"
for /f "tokens=2 delims=" %%? in ('findstr "^::Last update\" "%o%"') do (set "lastupdate_l=%%?")
if not defined lastupdate_l (set "lastupdate_l=06/06/2007")
for /f "tokens=2 delims=" %%? in ('findstr "^::Last update\" "c"') do (set "lastupdate_n=%%?")
if "%lastupdate_l%" lss "%lastupdate_n%" (
echo New version detected. Press any key to start updating. After the update is completed, the program will automatically exit. Please run it again
pause>nul
copy "c" "%o%"
) else (echo This program is currently the latest version. Press any key to exit&pause>nul)
goto :eof
::Attached - Microsoft patch automatic installation command:::::::::::::::::::
*.exe /passive /norestart parameters
-u Unattended mode
-f Force other programs to close when shutting down
-n Do not back up files for uninstallation
-o Do not prompt to overwrite OEM files
-z Do not restart after installation
-q Installation mode (no user participation)
-l List installed patch programs
-s:<dir> Integrate Service Pack files into <dir> path
-d:<dir> Back up files to <dir> path
::::::::::::::::::::::::::::::::::::::::::::::
::
|
|
2007-12-7 01:20 |
|
|
zh159
金牌会员
     
积分 3687
发帖 1467
注册 2005-8-8
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
试过systeminfo查找已安装补丁,但KB的我的机子只找出106个,注册表可以找出113个,所以放弃systeminfo查找已安装补丁
而新补丁不打算用P下载,使用360安全卫士和KV查找、下载漏洞补丁方便得多
Tried systeminfo to find installed patches, but my computer only found 106 KB ones, and the registry found 113, so I gave up using systeminfo to find installed patches. And I don't plan to use P to download new patches; it's much more convenient to use 360 Safe Guard and KV to find and download vulnerability patches.
|

 |
|
2007-12-7 02:16 |
|
|
fastslz
铂金会员
       DOS一根葱
积分 5493
发帖 2315
注册 2006-5-1 来自 上海
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
是的,用处并不大,只是重新安装补丁。只是找不到相应的Ftp网站,不然自动下载这些补丁重新安装或者收集,今天去google下有没有相应的网站。
另外zh159兄最后应该还要清理KB留下的垃圾
Yes, it's not very useful, just reinstalling patches. Just can't find the corresponding Ftp website, otherwise would automatically download these patches and reinstall or collect them. Went to Google today to see if there's a corresponding website.
Also, Brother zh159 should probably clean up the garbage left by KB finally
|

第一高手 第二高手
我的小站
 |
|
2007-12-7 08:41 |
|
|
fastslz
铂金会员
       DOS一根葱
积分 5493
发帖 2315
注册 2006-5-1 来自 上海
状态 离线
|
|
2007-12-7 09:37 |
|
|
fastslz
铂金会员
       DOS一根葱
积分 5493
发帖 2315
注册 2006-5-1 来自 上海
状态 离线
|
|
2007-12-7 09:57 |
|
|
shtcool
初级用户
 
积分 49
发帖 20
注册 2007-10-23
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
请教一下:set "☉%%str:~0,8%%= " 这句有何用处?清空环境变量☉kb... ?
Last edited by shtcool on 2007-12-7 at 12:04 PM ]
Ask: What is the use of the sentence "set "☉%%str:~0,8%%= "? To clear the environment variable ☉kb...?
Last edited by shtcool on 2007-12-7 at 12:04 PM ]
|
|
2007-12-7 11:37 |
|
|
vkill
金牌会员
     
积分 4103
发帖 1744
注册 2006-1-20 来自 甘肃.临泽
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
只是以前写的,当时就觉得用处不大就没有发,昨天看到这个帖子就随便附上了,留给想看的人看好了
Just something I wrote before. At that time, I thought it wasn't very useful, so I didn't post it. Yesterday, I saw this post and just attached it casually, for those who want to see it.
|
|
2007-12-7 17:17 |
|
|
nipo
中级用户
  
积分 228
发帖 106
注册 2008-4-26
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
你们打补丁的P~~~搞得这么复杂啊?
Why is the patch you're making so complicated?
|
|
2008-5-12 01:49 |
|
|
cnds
初级用户
 
积分 37
发帖 36
注册 2008-12-2
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
我也基本上看不懂,太高深了。
I also basically can't understand, it's too advanced.
|
|
2010-10-18 22:48 |
|