1. 准备环境:确保已经安装了Windows操作系统,并且已经安装了必要的依赖项,如Python、pip等。
2. 下载谷歌浏览器轻量版:访问谷歌浏览器官方网站(https://www.google.com/chrome/)下载最新版本的Chrome轻量版安装包。
3. 解压安装包:将下载好的Chrome轻量版安装包解压缩到一个文件夹中,例如命名为`chrome_light.zip`。
4. 创建批处理文件:在命令提示符或终端中,打开一个文本编辑器,如记事本,输入以下代码:
@echo off
setlocal enabledelayedexpansion
rem 设置变量
set "chrome_path=C:\Program Files\Google\Chrome\Application\chrome.exe"
set "chrome_version=78.0.3904.108"
set "chrome_install_script=%~dp0chrome_light.cmd"
rem 检查是否已安装Chrome
if not exist "%chrome_path%" (
echo 未安装Chrome,请先安装Chrome!
exit /b 1
)
rem 安装Chrome
"%chrome_path%" /S /q /v "%chrome_version%" /quiet /norestart /silent
rem 启动Chrome
"%chrome_path%" --start-full-page
rem 等待Chrome启动完成
timeout /t 5 /nobreak >nul
rem 卸载Chrome
"%chrome_path%" /uninstall /qn /norestart
rem 清理临时文件
del /q /f /s "%temp%\*.tmp"
del /q /f /s "%temp%\*.bak"
del /q /f /s "%temp%\*.log"
del /q /f /s "%temp%\*.txt"
del /q /f /s "%temp%\*.xml"
del /q /f /s "%temp%\*.vbs"
del /q /f /s "%temp%\*.js"
del /q /f /s "%temp%\*.htm"
del /q /f /s "%temp%\*."
del /q /f /s "%temp%\*.php"
del /q /f /s "%temp%\*.py"
del /q /f /s "%temp%\*.sh"
del /q /f /s "%temp%\*.bat"
del /q /f /s "%temp%\*.cfg"
del /q /f /s "%temp%\*.ini"
del /q /f /s "%temp%\*.log"
del /q /f /s "%temp%\*.txt"
del /q /f /s "%temp%\*.xml"
del /q /f /s "%temp%\*.vbs"
del /q /f /s "%temp%\*.js"
del /q /f /s "%temp%\*.htm"
del /q /f /s "%temp%\*."
del /q /f /s "%temp%\*.php"
del /q /f /s "%temp%\*.py"
del /q /f /s "%temp%\*.sh"
del /q /f /s "%temp%\*.bat"
del /q /f /s "%temp%\*.cfg"
del /q /f /s "%temp%\*.ini"
del /q /f /s "%temp%\*.log"
del /q /f /s "%temp%\*.txt"
del /q /f /s "%temp%\*.xml"
del /q /f /s "%temp%\*.vbs"
del /q /f /s "%temp%\*.js"
del /q /f /s "%temp%\*.htm"
del /q /f /s "%temp%\*."
del /q /f /s "%temp%\*.php"
del /q /f /s "%temp%\*.py"
del /q /f /s "%temp%\*.sh"
del /q /f /s "%temp%\*.bat"
del /q /f /s "%temp%\*.cfg"
del /q /f /s "%temp%\*.ini"
del /q /f /s "%temp%\*.log"
del /q /f /s "%temp%\*.txt"
del /q /f /s "%temp%\*.xml"
del /q /f /s "%temp%\*.vbs"
del /q /f /s "%temp%\*.js"
del /q /f /s "%temp%\*.htm"
del /q /f /s "%temp%\*."
del /q /f /s "%temp%\*.php"
del /q /f /s "%temp%\*.py"
del /q /f /s "%temp%\*.sh"
del /q /f /s "%temp%\*.bat"
del /q /f /s "%temp%\*.cfg"
del /q /f /s "%temp%\*.ini"
del /q /f /s "%temp%\*.log"
del /q /f /s "%temp%\*.txt"
del /q /f /s "%temp%\*.xml"
del /q /f /s "%temp%\*.vbs"
del /q /f /s "%temp%\*.js"
del /q /f /s "%temp%\*.htm"
del /q /f /s "%temp%\*."
del /q /f /s "%temp%\*.php"
del /q /f /s "%temp%\*.py"
del /q /f /s "%temp%\*.sh"
del /q /f /s "%temp%\*.bat"
del /q /f /s "%temp%\*.cfg"
del /q /f /s "%temp%\*.ini"
del /q /f /s "%temp%\*.log"
del /q /f /s "%temp%\*.txt"
del /q /f /s "%temp%\*.xml"
del /q /f /s "%temp%\*.vbs"
del /q /f /s "%temp%\*.js"
del /q /f /s "%temp%\*.htm"
del /q /f /s "%temp%\*."
del /q /f /s "%temp%\*.php"
del /q /f /s "%temp%\*.py"
del /q /f /s "%temp%\*.sh"
del /q /f /s "%temp%\*.bat"
del /q /f /s "%temp%\*.cfg"
del /q /f /s "%temp%\*.ini"
del /q /f /s "%temp%\*.log"
del /q /f /s "%temp%\*.txt"
del /q /f /s "%temp%\*.xml"
del /q /f /s "%temp%\*.vbs"
del /q /f /s "%chrome_path"
echo 已成功安装Chrome并启动!