-
Notifications
You must be signed in to change notification settings - Fork 5
命令行管理Windows服务
chen shucheng edited this page Oct 8, 2018
·
5 revisions
主要讲解net 和sc 它们都是位于system32下的
sc query
sc query iisadmin
sc start iisadmin
net start iisadmin
sc stop iisadmin
net stop iisadmin
sc create services binpath= "F:\net\Services.exe" type= own start= demand displayname= "service test" depend= iisadmin/Schedule
注意:等号后面必须空一格
创建服务后可以通过服务管理器来验证一下
sc delete services
补充:如果用SC命令不能删除服务,可以从注册表里删除。
开始->运行 reg delete HKLM/SYSTEM/CurrentControlSet/Services/ServiceName
sc enumdepend iisadmin
可以直接在cmd里输入sc
服务显示名和注册键的区别,显示名称主要是在外面显示的名字(如Subversion Server)可以用命令msconfig和service.msc来查看键名,另一种方法是用regedit注册表中HKEY_LOCAL_MACHINE->system->service中去查看
键名和显示名的转化:
sc GetKeyName (显示名) ---->由显示名得到键名
sc GetDisplayName (键名)---->由键名得到显示名