Windows手動添加服務 sc create


命令行創建服務項: sc create

用法:
sc <server> create [service name] [binPath= ] <option1> <option2>...

選項:
注意: 選項名稱包括等號,等號和值之間需要一個空格
type= <own|share|interact|kernel|filesys|rec|userown|usershare>    (默認 = own)
start= <boot|system|auto|demand|disabled|delayed-auto>              (默認 = demand)
error= <normal|severe|critical|ignore>                                           (默認 = normal)
binPath= <.exe 文件的 BinaryPathName>
group= <LoadOrderGroup>
tag= <yes|no>
depend= <依存關系(以 / (斜杠)分隔)>
obj= <AccountName|ObjectName>             (默認= LocalSystem)
DisplayName= <顯示名稱>
password= <密碼>

 

示例:將 Redis 添加到服務,以管理員身份運行命令提示符

sc create Redis6.2.6 binPath= "D:\Redis6.2.6\redis-server.exe --service-run \"D:\Redis6.2.6\redis-windows.conf\"" DisplayName= Redis6.2.6 start= auto

命令中的雙引號使用反斜杠加引號 \" 來進行轉義處理

 

設置服務的描述: sc description

用法:
sc <server> description [service name] [description]

 

示例:修改 Redis 描述

sc description Redis6.2.6 "This service runs the Redis server"

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM