Windows下一键更新Chromium Snapshot绿色版批处理文件

来源:互联网 发布:w2003办公软件下载 编辑:程序博客网 时间:2024/06/05 05:22
批处理说明:


本批处理文件既可以全新安装Chromium也可以更新现有的Chromium,但是存在排他性,需要严格按照下面的目录结构才能使用。安装浏览器为绿色版,无注册表写入,无多余文件(浏览器运行时候生成的文件是谷歌那么设计的,别找我),不需要时候直接删除文件夹就行。其中TheVersionNow为脚本创建文件,用于识别当前的浏览器版本号,方便日后更新,每次更新后会自动刷新,并非浏览器运行所需文件。


使用方法:


解压文件到要安装的目录,例如要安装到C盘Software文件夹下,起名为Chromium(C:\Software\Chromium),就将文件解压到Chromium里。Chromium里的目录结构如下,其中前面为“-”的为安装前文件夹里运行所必须的文件,前面为“+”的为安装后建立的文件,前面为“~”的为非必须文件。


安装后目录结构:
-文件 :UpdatePlus.bat
-文件 :WinRAR.exe
-文件 :aria2c.exe
~文件 :Readme.txt
+文件夹 :chrome-win32
+文件夹 +文件群 :Chromium文件群
+文件夹 +文件 :TheVersionNow
+快捷方式 :Chromium.lnk


运行UpdatePlus.bat即可更新。在运行过程中,如果弹出各类提示,无论系统还是大数字百毒疼殉各种卫士杀毒软件,请一律允许。本文件设计敏感操作只有修改hosts,但是最后正常退出时候会还原,覆盖旧版本时候可能会提示修改dll文件(大数字脑子有病么?复制文件也认为是修改),属正常反应。如依然不放心,可自行百度其他更新方法,用不用在你。


生成的Chromium.lnk快捷方式可随意复制到任何地方,只要不改文件夹名字可以一直使用,更改后需要更新一次浏览器生成新的快捷方式。


bug预警:出现访问被拒绝的字眼时候,右击UpdatePlus,选择编辑,把“takeown /f %windir%\System32\drivers\etc\hosts  /a”这一行剪切到“echo 正在修改hosts...”这句的下一行,然后关闭,保存,执行。这样操作以后hosts文件的所有者会改变,一般来说不会出问题,但是由于用户环境千变万化,不保证会出现什么未知问题。


其中批处理主要代码如下,删除了部分非必须代码,友好版本请下载下面的文件

%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exitcd /d "%~dp0"if exist .\chrome-win32\TheVersionNow (for /f %%v in (.\chrome-win32\TheVersionNow) do set ver1=%%v) else (set ver1=0)if %ver1%==0 (copy /y %windir%\System32\drivers\etc\hosts %windir%\System32\drivers\etc\hosts.bak.txttakeown /f %windir%\System32\drivers\etc\hosts  /aecho.>>%windir%\System32\drivers\etc\hostsecho 216.58.221.144commondatastorage.googleapis.com>>%windir%\System32\drivers\etc\hostsipconfig /flushdns)if exist ".\LAST_CHANGE" del /q ".\LAST_CHANGE"aria2c.exe https://commondatastorage.googleapis.com/chromium-browser-snapshots/Win_x64/LAST_CHANGEfor /f %%v in (.\LAST_CHANGE) do (set ver=%%vdel /q ".\LAST_CHANGE")if %ver%==%ver1% (echo 版本号相同,是否继续?choice /c 12 /t 5 /d 2 /n /m "1. 是;2. 否。请选择:"if ERRORLEVEL 2 goto Endif ERRORLEVEL 1 echo 继续更新!) else (echo 有新版本,是否继续?choice /c 12 /t 5 /d 2 /n /m "1. 是;2. 否。请选择:"if ERRORLEVEL 2 goto Endif ERRORLEVEL 1 echo 继续更新!)set url=https://commondatastorage.googleapis.com/chromium-browser-snapshots/Win_x64/%ver%/chrome-win32.zipif exist ".\chrome-win32.zip@redirect_counter=1" del /q ".\chrome-win32.zip@redirect_counter=1"if exist ".\chrome-win32.zip" del /q ".\chrome-win32.zip"aria2c.exe %url%WinRAR x -o+ -ibck chrome-win32.zipif exist ".\chrome-win32.zip" del /q ".\chrome-win32.zip"echo %ver%>.\chrome-win32\TheVersionNowecho ThePath = "%~dp0\chrome-win32\chrome.exe">temp.vbsecho lnkname = "Chromium.lnk">>temp.vbsecho WS = "Wscript.Shell">>temp.vbsecho Set Shell = CreateObject(WS)>>temp.vbsecho Set Link = Shell.CreateShortcut(lnkname)>>temp.vbsecho Link.TargetPath = ThePath>>temp.vbsecho Link.Save>>temp.vbsecho Set fso = CreateObject("Scripting.FileSystemObject")>>temp.vbsecho f = fso.DeleteFile(WScript.ScriptName)>>temp.vbsstart temp.vbsif exist ".\temp.vbs" del /q ".\temp.vbs":Endmove /y %windir%\System32\drivers\etc\hosts.bak.txt %windir%\System32\drivers\etc\hostsipconfig /flushdns

由于资源上传了还没通过审核,暂时先放百度网盘的链接:

链接: http://pan.baidu.com/s/1kVpwtVL 密码: 2333

CSDN下载链接:

http://download.csdn.net/detail/q7065761/9720847


目前存在的问题:

aria2c在越过长城用https协议下载文件时候会出现下面的问题

由于吊销服务器已脱机,吊销功能无法检查吊销。
希望各位大神能提供一个解决方案

0 0