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"

 

posted @   kjcy8  阅读(1032)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· .NET周刊【3月第1期 2025-03-02】
· [AI/GPT/综述] AI Agent的设计模式综述
点击右上角即可分享
微信分享提示