- 将下列内容存为 bat 文件
- clash-windows-amd64.exe 可以放在任何地方,内容中的路径需要修改
- 双击即可启动或关闭
- 正常启动是最小化,如果想隐藏窗口的话,请使用管理员模式(关闭的时候也要用管理员模式)
- 适用于 Windows
- 如果想看日志,可以在配置文件中配置一下 external-controller,就可以用浏览器查看
启动脚本
@echo off
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f >nul 2>nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /d "127.0.0.1:7890" /f >nul 2>nul
cd %userprofile%\.config\clash
powershell -WindowStyle Hidden -Command "& {C:\Tools\clash\clash-windows-amd64.exe -f config.yaml}"
关闭脚本
@echo off
taskkill /F /IM clash-windows-amd64.exe
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f >nul 2>nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /d "" /f >nul 2>nul