有些时候我们在安装Clash服务模式时报user did not grant permission错误,无法完成安装,这个时候我们可以进行手动安装,具体步骤如下:
首先确定系统安装了.NET framework runtime
,然后尝试手动安装:
1.打开 C:/Program Files
目录,新建 Clash for Windows Service
目录;
2.进入Clash安装目录/resources/static/files/win/[x64|arm64|ia32]/service
目录,拷贝里面两个 exe 文件到 1 中新建目录中;
3.进入 安装目录/resources/static/files/win/common
目录,拷贝 service.yml
文件到步骤 1 的新建目录中;
4.在 1 中新建目录中,使用管理员权限打开 CMD 依次执行以下命令:
service.exe install
service.exe start
如果 install 时出现如下提示:
Service with id 'Clash Core Service' already exists
To install the service, delete the existing one or change service Id in the configuration file
2022-09-26 09:37:32,316 FATAL - Unhandled exception
System.Exception: Installation failure: Service with id 'Clash Core Service' already exists
at WinSW.Program.<Run>g__Install|2_0(<>c__DisplayClass2_0& )
at WinSW.Program.Run(String[] argsArray, IWinSWConfiguration descriptor)
at WinSW.Program.Main(String[] args)
System.Exception: Installation failure: Service with id 'Clash Core Service' already exists
at WinSW.Program.<Run>g__Install|2_0(<>c__DisplayClass2_0& )
at WinSW.Program.Run(String[] argsArray, IWinSWConfiguration descriptor)
at WinSW.Program.Main(String[] args)
可以先执行:
service.exe stop
service.exe uninstall
如果安装后,Service Mode manage 里显示 active 但图标显示红色,可以进入 Home Directory
管理员启动 CMD,执行 icacls.exe service /remove:d Everyone
后手动删除 service 文件夹,重启 APP 即可