1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
| @echo off
color 2f
mode con cols=85 lines=22
title Symantec更新包[XP-i32]在线下载工具 Ver 1.3 By Mars.Ge
pushd "%~dp0"
rem 检查是否重复打开工具:
cls
tasklist | findstr /i "wget.exe" >nul && taskkill /f /im wget.exe >nul 2>nul
for /f %%z in ('dir /b "%~dp0"^|FIND "-"') do (
if exist %%z del /s /q /f %%z >nul 2>nul
)
mode con cols=85 lines=22
cls
rem 获取更新包页面源代码
echo ----------%date%,Symantec更新包下载记录---------->>Sym_Update.log
echo Begin:>>Sym_Update.log
if exist cs-n95.html del /S /Q /F cs-n95.html >nul
if exist csn95.html del /S /Q /F csn95.html >nul
rem 若不需要使用代理下载,请删除双引号之间的内容
wget -e "http_proxy=http://192.168.2.1:3128/" http://www.symantec.com/avcenter/download/pages/CS-N95.html
cls
rem 对比本地更新包与官网
setlocal enabledelayedexpansion
for /f tokens^=2*^ delims^=^" %%i in ('type cs-n95.html ^| findstr /v "v5i32" ^| findstr /i "i32.exe"') do (
set address=%%i
for /f "tokens=4 delims=/-" %%a in ("!address!") do set F_date=%%a
)
for /f "tokens=1 delims=-" %%f in ('dir /b "D:\Symantec\Update" ^| FIND "-"') do (set O_date=%%f)
if !F_date! NEQ !O_date! (echo 发现新版Symantec更新包,下载中,请勿关闭窗口......
echo !time:~0,8!===^>发现新版Symantec更新包[!f_date!],开始下载......>>Sym_Update.log
rem 若不需要使用代理下载,请删除双引号之间的内容
wget -c -e "http_proxy=http://192.168.2.1:3128/" "!address!"
echo !time:~0,8!===^>Symantec更新包[!f_date!]下载完毕!>>Sym_Update.log
echo !time:~0,8!===^>正在重命名旧的更新包,以便更新失败时恢复...>>Sym_Update.log
for /f %%m in ('dir /B /S "D:\Symantec\Update"^|FIND "-"') do set Oldpath1=%%m & move /y "%%m" "D:\Symantec\Update\oldPath.exe" >nul
if exist cs-n95.html del /S /Q /F cs-n95.html >nul
if exist csn95.html del /S /Q /F csn95.html >nul
echo !time:~0,8!===^>正在移动更新包.....>>Sym_Update.log
for /f %%z in ('dir /b "%~dp0"^|FIND "-"') do set newpath=%%~nxz & copy /y %%z "D:\Symantec\update"
if exist "D:\Symantec\update\%newpath%" echo !time:~0,8!===^>移动成功!>>Sym_Update.log
if not exist "D:\Symantec\update\%newpath%" move /y "D:\Symantec\Update\oldPath.exe" "%Oldpath1%" >nul && echo !time:~0,8!===^>移动过程
出现未知错误,未成功更新更新包. >>Sym_Update.log && goto ending
echo !time:~0,8!===^>正在移除旧版更新包.....>>Sym_Update.log
if exist "D:\Symantec\Update\oldPath.exe" del /s /q /f "D:\Symantec\Update\oldPath.exe"
taskkill /f /im wget.exe 2>nul 1>nul
echo !time:~0,8!===^>恭喜!已成功更新至!F_date!.>>Sym_Update.log
if exist cs-n95.html del /S /Q /F cs-n95.html >nul
if exist csn95.html del /S /Q /F csn95.html >nul
goto ending
) else (echo !time:~0,8!===^>经检测,官网和本地的Symantec更新包日期均为!o_date!,无需更新. >>Sym_Update.log
echo= >>Sym_Update.log
if exist cs-n95.html del /S /Q /F cs-n95.html >nul
if exist csn95.html del /S /Q /F csn95.html >nul
)
:ending
echo End. >>Sym_Update.log
echo= >>Sym_Update.log
echo= >>Sym_Update.log
exit
|