2014-01-17 21:09
@echo off
PUSHD %~dp0
color 0a
mode con lines=22
title 系统补丁批量安装程序
If not exist *.exe (if not exist *.msu goto next2)
ver|find /i " 6." >nul||goto test
echo .>%windir%\test.txt
if exist %windir%\test.txt (
del /f /q /a %windir%\test.txt>nul 2>nul
) else (
cls
echo.
echo.
echo 请右键◆以管理员身份运行◆本程序
echo 按任意键退出...
pause>nul
exit
)
goto test2
:test
echo .>%windir%\test.txt
if exist %windir%\test.txt (
del /f /q /a %windir%\test.txt>nul 2>nul
) else (
cls
echo.
echo.
echo 请以管理员身份登录电脑运行本程序
echo 按任意键退出...
pause>nul
exit
)
:test2
Set L1= ╭══════════════════╮
Set L2= ║ ║
Set L3= ╭══┤ 系统补丁批量安装程序 ├══╮
Set L4= ║ ║ ║ ║
Set L5= ║ ╰══════════════════╯ ║
Set L6= ║ ║
Set L7= ╟════════════════════════╢
Set L8= ║ 简单 安全 易用 ║
Set L9= ╰────────────────────────╯
:begin
CLS
Echo.
Echo %L1%
Echo %L2%
Echo %L3%
Echo %L4%
Echo %L5%
Echo %L6%
Echo %L6%
Echo ║ [1] 安装Windows补丁 ║
Echo ║ [2] 安装Office2003补丁 ║
Echo ║ [3] 安装Office2007、2010、2013补丁 ║
Echo ║ [0] 退出本程序 ║
Echo %L6%
Echo %L7%
Echo %L7%
Echo %L8%
Echo %L9%
echo.
echo.
set choice=
set /p choice= 选择要進行的操作 (1/2/3/0) ,然后按回车:
If "%choice%"=="" goto begin
If not "%choice%"=="" Set Choice=%Choice:~0,1%
If /i "%choice%"=="1" goto GO2
If /i "%choice%"=="2" goto GO3
If /i "%choice%"=="3" goto GO4
If /i "%choice%"=="0" exit
goto begin
:GO2
set str1=
ver | find "6." > NUL && (set XT=Windows NT6&set CX=Windows*-KB*.msu&set str=/quiet /norestart&set str1=wusa&goto TOP)
ver | find "5." > NUL && (set XT=Windows NT5&set CX=Windows*-KB*.exe&set str=/quiet /norestart&goto TOP)
goto TOP
:GO3
set XT=Office2003
set CX=*.exe
set str=/q
goto TOP
:GO4
set XT=Office2007_2010_2013
set CX=*.exe
set str=/quiet /norestart
goto TOP
:TOP
set title=%XT% 补丁批量安装程序
title %title%
set work=0
set no=0
set mo=0
set number=0
set hotfix=
set ko=▏
set kn=0
:Kong
if %kn% LSS 33 (set ko=%ko% &set /a kn=%kn%+1&goto Kong)
for /F %%s in ('dir /b /a-d %CX% ^| find /v /c ""') do set all=%%s
for /F %%i in ('dir /b /a-d /OD %CX%') do (set hotfix=%%i&call :show)
set hotfix=&call :show
goto end
:show
if %number% GTR %mo% (
set num=%num%█
set /a mo=%mo%+1
set ko=%ko:~0,-1%
goto show
)
cls
echo.
echo.
if "%hotfix%"=="" (echo %title% ) else (echo 正在安装:%hotfix%)
echo 進度: %no% / %all%
echo.&echo 已经完成 %work% %%%
echo ┌──────────────────────────────────┐
echo │%num%%ko%│&echo │%num%%ko%│&echo │%num%%ko%│
echo └──────────────────────────────────┘
echo.
if %work%==100 goto :EOF
::ping -n 1 127.1 >nul
%str1% %hotfix% %str% >nul 2>nul
set /a no=%no%+1
set /a work=(%no%)*100/(%all%) 2>nul
set /a number=%work%/3
set /a number=%number%+1
goto :EOF
:end
echo 安装完成,按任意键退出... (建议从新启动系统)
pause>nul
exit
:next2
cls
echo.
echo.
echo 没找到补丁程序
echo.
echo 补丁程序需要和批量安装程序放在同一个文件夹内
echo.
echo 按任意键退出 ...
pause>nul&exit
@echo off
PUSHD %~dp0
color 0a
mode con lines=22
title 系统补丁批量安装程序
setlocal enabledelayedexpansion
If not exist *.exe (if not exist *.msu goto next2)
ver|find /i " 6." >nul||goto test
echo .>%windir%\test.txt
if exist %windir%\test.txt (
del /f /q /a %windir%\test.txt>nul 2>nul
) else (
cls
echo.
echo.
echo 请右键◆以管理员身份运行◆本程序
echo 按任意键退出...
pause>nul
exit
)
goto test2
:test
echo .>%windir%\test.txt
if exist %windir%\test.txt (
del /f /q /a %windir%\test.txt>nul 2>nul
) else (
cls
echo.
echo.
echo 请以管理员身份登录电脑运行本程序
echo 按任意键退出...
pause>nul
exit
)
:test2
ver | find "6." > NUL && (
for /f "delims=" %%i in ('dir /a-d /b /od Windows*-KB*.msu 2^>nul') do (
set str=%%i
echo.
echo.
echo 正在安装 !str!
wusa !str! /quiet /norestart
cls
))
ver | find "5." > NUL && (
for /f "delims=" %%i in ('dir /a-d /b /od Windows*-KB*.exe 2^>nul') do (
set str=%%i
echo.
echo.
echo 正在安装 !str!
!str! /quiet /norestart
cls
))
cls
echo.
echo.
echo 安装完成,按任意键退出... (建议从新启动系统)
pause>nul
exit
:next2
cls
echo.
echo.
echo 没找到补丁程序
echo.
echo 补丁程序需要和批量安装程序放在同一个文件夹内
echo.
echo 按任意键退出 ...
pause>nul
exit