windows系统服务添加删除方法
具体步骤:
如需要添加一个服务,至少需要知道服务名称,可执行程序,依赖等信息。
一、步骤:
1、创建服务
打开命令行工具,输入:
 
C:Documents and Settingstiger>sc create dmadmin binPath= "C:WINDOWSsystem32dmadmin.exe" type= own start= auto  depend= PlugPlay/RpcSs/dmserver  DisplayName= "Logical Disk Manager Administrative Service"
create --创建服务操作
dmadmin --服务名称
binPath --可执行程序或DLL,OCX路径
start --是否自动开始
depend --依赖的服务
DisplayName --现实名称
执行结果:
[SC] CreateService SUCCESS
表示成功。若没有SUCCESS字样,则表示失败。
2、删除服务
 
复制代码 代码示例:
C:Documents and Settingstiger>sc delete dmadmin
[SC] DeleteService SUCCESS
3、注意
参数格式为:参数名称=【空格】参数
等号一定要加空格,等号前不要加空格。所有参数必须严格遵守此规定,否则不成功。
二、sc 使用参数参考
 
Creates a service entry in the registry and Service Database.
SYNTAX:
sc create [service name] [binPath= ] <option1> <option2>...
CREATE OPTIONS:
NOTE: The option name 
includes the equal sign.
 type= <own|share|interact|kernel|filesys|rec>
       (default = own)
 start= <boot|system|auto|demand|
disabled>
       (default = demand)
 error= <normal|severe|critical|ignore>
       (default = normal)
 binPath= <BinaryPathName>
 group= <LoadOrderGroup>
 tag= <yes|no>
 depend= <Dependencies(separated by / (forward slash))>
 obj= <AccountName|ObjectName>
       (default = LocalSystem)
 DisplayName= <display name>
 password= <password>