V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
rshun
V2EX  ›  分享发现

手工用命令行启动 clash

  •  
  •   rshun · 181 天前 · 1105 次点击
    这是一个创建于 181 天前的主题,其中的信息可能已经有所发展或是发生改变。
    • 将下列内容存为 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
    
    3 条回复    2023-11-03 08:42:48 +08:00
    AoEiuV020JP
        1
    AoEiuV020JP  
       181 天前
    改注册表设置代理这个效果不大好,有可能需要重启生效,还不如手动改,或者我是用 sysproxy.exe 修改系统代理,
    rshun
        2
    rshun  
    OP
       181 天前
    不需要重启系统,我一直都是手工启的
    SenLief
        3
    SenLief  
       181 天前 via iPhone
    没必要吧。win 自己有启动平台的,不过我还是喜欢用 nssm 。
    sudo nssm.exe start clash
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2206 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 06:01 · PVG 14:01 · LAX 23:01 · JFK 02:01
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.