微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用winsw给Win10添加服务

平台:win10

问题:把自启动程序添加为服务

解决过程:

一直习惯了用CLaunch启动各类应用程序,但近期不知怎么回事,每次进入系统CLaunch都不会自动启动。重装后也好用没几天。明明计划任务里CLaunch的启动设置很正常的。

于是干脆把ClAdmin.exe设置成服务好了。

使用WinSW的过程如下。

1、去https://github.com/kohsuke/winsw/releases下载WinSW的主程序WinSW.NET4.exe配置文件sample-minimal.xml

2、把WinSW.NET4.exesample-minimal.xml拷贝到CLaunch的安装路径D:\Program Files\CLaunch下。给WinSW.NET4.exe改名为CLauncher.exe,sample-minimal.xml改名为CLauncher.xml。

3、用Notepad++(或者notepad2)打开CLauncher.xml,进行部分设置如下

 

<service>

<!-- ID of the service. It should be unique across the Windows system-->
<id>CLaunch</id>
<!-- display name of the service -->
<name>CLaunch</name>
<!-- Service description -->
<description>CLaunch是个用于增强桌面功能快速启动软件,本服务由Windows Service Wrapper(WinSW)建立。</description>

<!-- Path to the executable, which should be started -->
<executable>D:\Program Files\CLaunch\ClAdmin.exe</executable>

 

 

 

</service>

 

4、用管理员权限打开CMD,定位到D:\Program Files\CLaunch下,输入CLauncher.exe install,回车,提示“Installing the service with id 'CLaunch'”服务安装成功。运行services.msc打开服务管理窗口,找到CLaunch服务,跟普通服务一样可以设置自动、手动、禁用,启用停用,发现可执行路径为"D:\Program Files\CLaunch\CLauncher.exe"。显然CLaunch.exe的启动是由WinSW中转了下。

5、想卸载该服务,可以重复4步骤,输入CLauncher.exe uninstall

 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。