您的位置:首页 > 其它

使用添加删除windows的系统服务的例子

2012-12-30 20:49 706 查看
使用SC 工具可以进行windows服务的添加和删除。步骤如下:

如需要添加一个服务,至少需要知道服务名称,可执行程序,依赖等信息。

一、步骤:

1、创建服务

打开命令行工具,输入:

C:\Documents and Settings\tiger>sc create dmadmin binPath= "C:\WINDOWS\system32\dmadmin.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 Settings\tiger>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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: