平台:win10
問題:把自啟動程序添加為服務
解決過程:
一直習慣了用CLaunch啟動各類應用程序,但近期不知怎么回事,每次進入系統CLaunch都不會自動啟動。重裝后也好用沒幾天。明明計划任務里CLaunch的啟動設置很正常的。
於是干脆把ClAdmin.exe設置成服務好了。
使用WinSW的過程如下。
1、去https://github.com/kohsuke/winsw/releases下載WinSW的主程序WinSW.NET4.exe和配置文件sample-minimal.xml。
2、把WinSW.NET4.exe和sample-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