联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
::::::::: $Id: upgrade.sav.defs.bat 98 2008-01-15 07:59:23Z honghunter $ @echo off & color 02 & title Upgrade SAV Defs by Zongzi ::::::::: 说明: ::: 运行本批处理文件,将首先从指定网站 (由 %defs_site% 参数指定), ::: 获得最新的Symantec AntiVirus的病毒库更新文件(defs)的文件名, ::: 然后下载该最新的defs到系统%temp_dir%目录下,并启动运行之。 ::: ::::::::: 其他说明: ::: 1,代理: ::: 在需要使用代理的环境下,请在下面这句中加上您使用的代理服务器的地址。 ::: 不用代理的e.g.: set "http_proxy=" ::: 使用代理的e.g.: set "http_proxy=192.168.1.1:8080" ::: 2,非32位系统: ::: 本批处理默认下载的是32位操作系统使用的defs文件。 ::: 对于非32位的操作系统,请注意修改 %HTML_STR_KEY%参数。 ::: ::::::::: 测试环境: ::: 本批处理文件,在如下环境下测试有效。 ::: Microsoft Windows XP Professional 版本 2002 Service Pack 2 ::: Symantec AntiVirus 10.0 ::: ::::::::: <br />版权说明: ::: <br />This 作品 by ::: <br /> <a xmlns:cc="http://creativecommons.org/ns#" href="www.dps4e.com" property="cc:attributionName" rel="cc:attributionURL">kevin shen</a> ::: <br /> is licensed under a ::: <br /> <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/2.5/cn/">Creative Commons 署名-非商业性使用-相同方式共享 2.5 中国大陆 License</a>. ::: ::::::::: set "http_proxy=" ::::::::: Init env :Init set wget_arg=--user-agent="Mozilla/4.0 (compatible; MSIE 6.0; Windws NT 5.1)" --cookies=on set "temp_html=index.html" set "temp_bat=tmp.bat" set "temp_bat2=tmp2.bat" set "temp_dir=c:\temp" set "debug=1" set "defs_site=1" if not "%http_proxy%"=="" set http_proxy_set= -e "http_proxy=%http_proxy%" if not "%http_proxy%"=="" set "wget_arg=%http_proxy_set% %wget_arg%" if not exist "%temp_dir%" mkdir "%temp_dir%" if "%1"=="sub1" goto :sub1 goto :site%defs_site% goto :default_site :default_site ::: site1是默认的设置,获取最新defs文件名的网站的设置。 :site1 set "defs_page_url=http://security.thusns.org/Symantec/files.html" set HTML_BODY_BEGIN="Files:" set HTML_BODY_END="unix" set HTML_STR_BEGIN="href=#." set "HTML_STR_BEGIN=%date:~0,4%" set HTML_STR_END="#>" set HTML_STR_KEY="i32.exe" set GETKEYSTR_ARG=-pt=d1 -bs=%HTML_BODY_BEGIN% -be=%HTML_BODY_END% -s="%HTML_STR_BEGIN%" -e=%HTML_STR_END% -k=%HTML_STR_KEY% set "base_url=http://definitions.symantec.com/defs/%HTML_STR_BEGIN%" goto :main :site2 set "defs_page_url=http://security.thusns.org/Symantec/files.html" set HTML_BODY_BEGIN="Files:" set HTML_BODY_END="unix" set HTML_STR_BEGIN="href=#." set HTML_STR_END="#>" set HTML_STR_KEY="i32.exe" set GETKEYSTR_ARG=-pt=d1 -bs=%HTML_BODY_BEGIN% -be=%HTML_BODY_END% -s=%HTML_STR_BEGIN% -e=%HTML_STR_END% -k=%HTML_STR_KEY% set "base_url=http://security.thusns.org/Symantec" goto :main :site3 set "defs_page_url=http://norton.ipcn.org/" set HTML_BODY_BEGIN="http://ipcn.org" set HTML_BODY_END="CERNET/教育网" set HTML_STR_BEGIN="http://ce.norton.ipcn.org" set HTML_STR_END=">" set HTML_STR_KEY="i32.exe" set GETKEYSTR_ARG=-bs=%HTML_BODY_BEGIN% -be=%HTML_BODY_END% -s=%HTML_STR_BEGIN% -e=%HTML_STR_END% -k=%HTML_STR_KEY% set "base_url=http://definitions.symantec.com/defs" goto :main :main ::::::::: * Main Process * set /a down_times=1 :try_down wget -T 60 -t 6 %wget_arg% "%defs_page_url%" -O%temp_dir%\%temp_html% if exist "%temp_dir%\%temp_html%" findstr /C:"-i32.exe" %temp_dir%\%temp_html% >nul && goto :html_down_ok set /a down_times+=1 if /i %down_times% GTR 3 goto :down_error goto :try_down :html_down_ok getkeystr.exe -cmd="call %0 sub1 " -i=%temp_dir%\%temp_html% %GETKEYSTR_ARG% >%temp_dir%\%temp_bat% if exist "%temp_dir%\%temp_bat%" findstr /C:"call" %temp_dir%\%temp_bat% >nul && goto :get_filename_ok goto :down_error :get_filename_ok call %temp_dir%\%temp_bat% if "%return%"=="" echo *** OK *** if not "%return%"=="" echo *** %return% *** call:clear_env pause goto :eof :clear_env @set wget_arg= @set temp_html= @set temp_bat= @set temp_bat2= @set temp_dir= @set debug= @set defs_site= @set defs_page_url= @set HTML_BODY_BEGIN= @set HTML_BODY_END= @set HTML_STR_BEGIN= @set HTML_STR_END= @set HTML_STR_KEY= @set GETKEYSTR_ARG= @set base_url= @set temp_file= @set down_times= @goto :eof :sub1 shift set temp_file=%temp_dir%\%2 if exist "%temp_file%" del /q/s %temp_file% wget.exe -T 60 -t 6 %wget_arg% "%base_url%%2" -O%temp_file% || goto:sub1_down_error echo ERRORLEVEL=%ERRORLEVEL% start %temp_file% /TEMP=c:\temp echo ERRORLEVEL=%ERRORLEVEL% set return=OK goto :eof :sub1_down_error echo *** Down Error *** set return=Error goto :eof :down_error call:clear_env echo *** Down Error *** pause goto :eof