China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-12 04:26
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Original]XP Patch Automatic Installation View 2,405 Replies 10
Original Poster Posted 2007-12-07 00:32 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
21-year member
UID 44210
Status Offline
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 ]
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
lijinan +2 2010-06-19 18:14
Floor 2 Posted 2007-12-07 01:02 ·  中国 甘肃 定西 电信
金牌会员
★★★★
Credits 4,103
Posts 1,744
Joined 2006-01-20 13:00
20-year member
UID 49241
Gender Male
From 甘肃.临泽
Status Offline
I want to attach the installation parameters of the patch after p, so that p is more perfect
Floor 3 Posted 2007-12-07 01:20 ·  中国 甘肃 定西 电信
金牌会员
★★★★
Credits 4,103
Posts 1,744
Joined 2006-01-20 13:00
20-year member
UID 49241
Gender Male
From 甘肃.临泽
Status Offline
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
::::::::::::::::::::::::::::::::::::::::::::::

::


Floor 4 Posted 2007-12-07 02:16 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
21-year member
UID 44210
Status Offline
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.
Floor 5 Posted 2007-12-07 08:41 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
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
第一高手 第二高手

Floor 6 Posted 2007-12-07 09:37 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
Microsoft HTTP patch address list
http://www.littleyu.com/article/windows_spack.html
第一高手 第二高手

Floor 7 Posted 2007-12-07 09:57 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
Use mirror sites in China for Windows Update. These sites are updated synchronously with Microsoft. The following are several relatively fast ones:
Xi'an Jiaotong University: http://202.117.21.253/
Xiamen University: http://windowsupdate.xmu.edu.cn
Shanghai Jiao Tong University: http://windowsupdate.sjtu.edu.cn
第一高手 第二高手

Floor 8 Posted 2007-12-07 11:37 ·  中国 甘肃 兰州 城关区 电信
初级用户
Credits 49
Posts 20
Joined 2007-10-23 11:47
18-year member
UID 100538
Gender Male
Status Offline
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 ]
Floor 9 Posted 2007-12-07 17:17 ·  中国 甘肃 兰州 电信
金牌会员
★★★★
Credits 4,103
Posts 1,744
Joined 2006-01-20 13:00
20-year member
UID 49241
Gender Male
From 甘肃.临泽
Status Offline
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.
Floor 10 Posted 2008-05-12 01:49 ·  中国 辽宁 锦州 联通
中级用户
★★
Credits 228
Posts 106
Joined 2008-04-26 12:34
18-year member
UID 117003
Gender Male
Status Offline
Why is the patch you're making so complicated?
Floor 11 Posted 2010-10-18 22:48 ·  中国 上海 奉贤区 电信
初级用户
Credits 37
Posts 36
Joined 2008-12-02 13:29
17-year member
UID 132662
Gender Male
Status Offline
I also basically can't understand, it's too advanced.
Forum Jump: