命令行创建服务项: 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]
sc description Redis6.2.6 "This service runs the Redis server"
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。