中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-12 16:01
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » [Help] Batch file to install system patches — I can't continue writing it, can someone help me
Printable Version  965 / 2
Floor1 qq275757820 Posted 2009-10-02 14:10
新手上路 Posts 3 Credits 5
This is the way I want it to look
Installed patch names as follows Installation progress 24/60
kB**** kb**** kb**** kb**** kb**** kb****
kB**** kb**** kb**** kb**** kb**** kb****
kB**** kb**** kb**** kb**** kb**** kb****
kB**** kb**** kb**** kb**** kb**** kb****


This is how my program currently looks when it runs
Installed patch names as follows Installation progress 24/60
kB****



Below is the incomplete code I wrote. I hope it can be completed
@echo off
title System patch package updated to ** year ** month ** day
MODE con: COLS=50 LINES=22
color 0a
:start0
echo ╭─────────────╮
echo ╭───┤ System Patch Installer ├───╮
echo │ ╰─────────────╯ │
echo │ 1.windows-XP-sp2 Chinese edition patch package │
echo │ 2.windows-XP-sp2 English edition patch package │
echo │ 3.Internet Explorer 6 patch package │
echo │ 4.Internet Explorer 7 patch package │
echo │ 5. Exit this program │
echo │ 6.Exit this program and restart the computer │
echo │ │
echo ╰─────────────────────╯
set /p list0=Please enter an option:
if "%list0%"=="1" goto list0_1
if "%list0%"=="2" goto list0_2
if "%list0%"=="3" goto list0_3
if "%list0%"=="4" goto list0_4
if "%list0%"=="5" goto list0_5
if "%list0%"=="6" goto list0_6
goto start0

:list0_1
MODE con: COLS=50 LINES=22
echo System patches will be installed shortly, press any key to continue
pause >nul

dir /b xp-sp2-chs\* >0.txt

set sum=0
set n=1

set tmep=replace_bak.tmp
setlocal enabledelayedexpansion

for /f "tokens=1* delims=:" %%i in ('findstr /i /n .* 0.txt') do (
set str=%%j
if not "!str!"=="" set "str=!str:.bat=!"
>>"%tmep%" echo.!str!
set /a sum=sum+1>nul
)
move "%tmep%" 0.txt

for /f "tokens=1* delims=:" %%m in (0.txt) do (
start /wait .\xp-sp2-chs\%%m.bat

cls
echo The following patches have been installed Progress: !n! /!sum!
echo %%m

set /a n=n+1
)
del 0.txt
echo Press any key to return to the main menu
pause >nul & goto start0


:list0_2






:list0_3





:list0_4




:list0_5
exit
:list0_6
::shutdown -r -t now
Floor2 www0com0my Posted 2009-10-05 10:58
初级用户 Posts 19 Credits 31
I previously found 2 batch files for installing patches online.

Maybe you can use them for reference.

Floor3 www0com0my Posted 2009-10-05 10:59
初级用户 Posts 19 Credits 31
Here's another, more advanced one.

[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023