希望高手们看看。
===========================
我局机关局域网在建成后长期受系统漏洞和病毒攻击的困扰,致使网络经常瘫痪。为解决该问题,我们利用共享方式在通讯室的机器(访问方法:\\10.157.xx.xx)上实现了在局域网中自动安装系统补丁和最新病毒库的方案,下面是脚本文件的说明。
@echo off
cls
echo.
echo ********************************
echo * *
echo * 功能:在不能上互联网的内网中安装M$补丁的脚本 *
echo * 限制:该版本只能用于 WINDOWS XP SP2 简体中文版,其他版 *
echo * 本正在制作中。 *
echo * 制作人:余振中 *
echo * e-mail:yuzhenzhong@163.net *
echo * 补丁时间:2005年3月18日 *
echo * *
echo ********************************
echo.
rem 设置服务器IP及共享路径
set HotPatch=\\c02\hotfix\xp\sp2
rem 创建临时文件夹
set mhnet=%temp%\mhnet
rem @rmdir /S /Q %mhnet% 2>NUL 1>NUL
mkdir %mhnet%
rem 主程序开始
:Start
rem 检查配套文件完整性
rem call :AllFiles
rem 检查是否属于WINDOWS XP SP2系统
call :CheckSystem
rem 检查是否拥有管理员权限
call :CheckAdmin
echo.
pause
rem 开始升级系统
call :HotfixUp
rem 删除临时目录,清空变量
rmdir /S /Q %mhnet% 2>NUL 1>NUL
set mhnet=
set HotPatch=
goto :eof
exit
:ends
rem 主程序结束
rem *************************
rem *************************
rem 判断系统版本是否为WINDOWS XP SP2,否则退出
rem *************************
rem *************************
:CheckSystem
rem 先判断系统版本是否为WINDOWS NT系列,若为WIN98系列则退出
IF %OS%==Windows_NT (
rem 再次判断系统版本是否为SP2
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "CSDVersion" >%mhnet%\banben.log
find "Service Pack 2" %mhnet%\banben.log >NUL
IF ERRORLEVEL 1 (
cls
echo.
echo 注意:本程序只能用在 Windows XP SP2 版本的系统上。
echo 请先升级到 Windows XP SP2,再运行本程序!!!
pause
exit
) else (
echo 用户使用 Windows XP SP2 的系统,
)
) else (
rem 系统为win98系列.
cls
echo.
echo 运行错误!
echo.
echo 注意:本程序不能用在 %os% 系列版本的系统上。
pause
exit
)
goto :eof
rem *************************
rem *************************
rem 判断是否具有管理员权限,否则退出
rem *************************
rem *************************
:CheckAdmin
net user %username% > %mhnet%\ifadmin.log
rem 如果不是系统管理员
find "*Administrators " %mhnet%\ifadmin.log >NUL
IF ERRORLEVEL 1 (
cls
echo 运行出错!
echo.
echo 注意:用户不是系统管理员组成员 ,不能执行本程序!!!
echo 请更换有足够权限的用户重新运行本程序。
pause
exit
goto :eof
) else (
echo 用户属于系统管理员组,可以执行本程序。
)
goto :eof
rem *************************
rem *************************
rem 将服务器上的共享补丁包目录映射为本地盘S,并逐一运行补丁包
rem *************************
rem *************************
:HotfixUp
net use S: %HotPatch%
S:
cls
echo 注意!不要关闭本程序,系统升级完毕后会自动退出。
echo 正在升级系统,请等待......
IF not EXIST %SystemRoot%\KB834707.log KB834707.exe /passive /norestart
IF not EXIST %SystemRoot%\KB867282.log KB867282.exe /passive /norestart
IF not EXIST %SystemRoot%\KB873333.log KB873333.exe /passive /norestart
IF not EXIST %SystemRoot%\KB873339.log KB873339.exe /passive /norestart
IF not EXIST %SystemRoot%\KB885250.log KB885250.exe /passive /norestart
IF not EXIST %SystemRoot%\KB885835.log KB885835.exe /passive /norestart
IF not EXIST %SystemRoot%\KB886185.log KB886185.exe /passive /norestart
IF not EXIST %SystemRoot%\KB887742.log KB887742.exe /passive /norestart
IF not EXIST %SystemRoot%\KB888113.log KB888113.exe /passive /norestart
IF not EXIST %SystemRoot%\KB890047.log KB890047.exe /passive /norestart
IF not EXIST %SystemRoot%\KB890175.log KB890175.exe /passive /norestart
IF not EXIST %SystemRoot%\KB891781.log KB891781.exe /passive /norestart
IF not EXIST %SystemRoot%\KB887472.log KB887472.exe /q
rem 修复一次运行多个补丁包而不重启系统可能造成的未决文件版本问题
Qchain.exe
rem 删除本地共享映射驱动器
C:
net use S: /Delete /Y
goto :eof
rem ----- this is the end of this batch file -------
===========================
我局机关局域网在建成后长期受系统漏洞和病毒攻击的困扰,致使网络经常瘫痪。为解决该问题,我们利用共享方式在通讯室的机器(访问方法:\\10.157.xx.xx)上实现了在局域网中自动安装系统补丁和最新病毒库的方案,下面是脚本文件的说明。
@echo off
cls
echo.
echo ********************************
echo * *
echo * 功能:在不能上互联网的内网中安装M$补丁的脚本 *
echo * 限制:该版本只能用于 WINDOWS XP SP2 简体中文版,其他版 *
echo * 本正在制作中。 *
echo * 制作人:余振中 *
echo * e-mail:yuzhenzhong@163.net *
echo * 补丁时间:2005年3月18日 *
echo * *
echo ********************************
echo.
rem 设置服务器IP及共享路径
set HotPatch=\\c02\hotfix\xp\sp2
rem 创建临时文件夹
set mhnet=%temp%\mhnet
rem @rmdir /S /Q %mhnet% 2>NUL 1>NUL
mkdir %mhnet%
rem 主程序开始
:Start
rem 检查配套文件完整性
rem call :AllFiles
rem 检查是否属于WINDOWS XP SP2系统
call :CheckSystem
rem 检查是否拥有管理员权限
call :CheckAdmin
echo.
pause
rem 开始升级系统
call :HotfixUp
rem 删除临时目录,清空变量
rmdir /S /Q %mhnet% 2>NUL 1>NUL
set mhnet=
set HotPatch=
goto :eof
exit
:ends
rem 主程序结束
rem *************************
rem *************************
rem 判断系统版本是否为WINDOWS XP SP2,否则退出
rem *************************
rem *************************
:CheckSystem
rem 先判断系统版本是否为WINDOWS NT系列,若为WIN98系列则退出
IF %OS%==Windows_NT (
rem 再次判断系统版本是否为SP2
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v "CSDVersion" >%mhnet%\banben.log
find "Service Pack 2" %mhnet%\banben.log >NUL
IF ERRORLEVEL 1 (
cls
echo.
echo 注意:本程序只能用在 Windows XP SP2 版本的系统上。
echo 请先升级到 Windows XP SP2,再运行本程序!!!
pause
exit
) else (
echo 用户使用 Windows XP SP2 的系统,
)
) else (
rem 系统为win98系列.
cls
echo.
echo 运行错误!
echo.
echo 注意:本程序不能用在 %os% 系列版本的系统上。
pause
exit
)
goto :eof
rem *************************
rem *************************
rem 判断是否具有管理员权限,否则退出
rem *************************
rem *************************
:CheckAdmin
net user %username% > %mhnet%\ifadmin.log
rem 如果不是系统管理员
find "*Administrators " %mhnet%\ifadmin.log >NUL
IF ERRORLEVEL 1 (
cls
echo 运行出错!
echo.
echo 注意:用户不是系统管理员组成员 ,不能执行本程序!!!
echo 请更换有足够权限的用户重新运行本程序。
pause
exit
goto :eof
) else (
echo 用户属于系统管理员组,可以执行本程序。
)
goto :eof
rem *************************
rem *************************
rem 将服务器上的共享补丁包目录映射为本地盘S,并逐一运行补丁包
rem *************************
rem *************************
:HotfixUp
net use S: %HotPatch%
S:
cls
echo 注意!不要关闭本程序,系统升级完毕后会自动退出。
echo 正在升级系统,请等待......
IF not EXIST %SystemRoot%\KB834707.log KB834707.exe /passive /norestart
IF not EXIST %SystemRoot%\KB867282.log KB867282.exe /passive /norestart
IF not EXIST %SystemRoot%\KB873333.log KB873333.exe /passive /norestart
IF not EXIST %SystemRoot%\KB873339.log KB873339.exe /passive /norestart
IF not EXIST %SystemRoot%\KB885250.log KB885250.exe /passive /norestart
IF not EXIST %SystemRoot%\KB885835.log KB885835.exe /passive /norestart
IF not EXIST %SystemRoot%\KB886185.log KB886185.exe /passive /norestart
IF not EXIST %SystemRoot%\KB887742.log KB887742.exe /passive /norestart
IF not EXIST %SystemRoot%\KB888113.log KB888113.exe /passive /norestart
IF not EXIST %SystemRoot%\KB890047.log KB890047.exe /passive /norestart
IF not EXIST %SystemRoot%\KB890175.log KB890175.exe /passive /norestart
IF not EXIST %SystemRoot%\KB891781.log KB891781.exe /passive /norestart
IF not EXIST %SystemRoot%\KB887472.log KB887472.exe /q
rem 修复一次运行多个补丁包而不重启系统可能造成的未决文件版本问题
Qchain.exe
rem 删除本地共享映射驱动器
C:
net use S: /Delete /Y
goto :eof
rem ----- this is the end of this batch file -------
