sc.exe 配置
修改注册表和服务控制管理器数据库中服务项的值。
语法
sc.exe [<servername>] config [<servicename>] [type= {own | share | kernel | filesys | rec | adapt | interact type= {own | share}}] [start= {boot | system | auto | demand | disabled | delayed-auto}] [error= {normal | severe | critical | ignore}] [binpath= <binarypathname>] [group= <loadordergroup>] [tag= {yes | no}] [depend= <dependencies>] [obj= {<accountname> | <objectname>}] [displayname= <displayname>] [password= <password>]
参数
| 参数 | 说明 |
|---|---|
<servername> |
指定服务所在的远程服务器的名称。 名称必须使用通用命名约定 (UNC) 格式 (例如,\myserver) 。 若要在本地运行 SC.exe,请不要使用此参数。 |
<servicename> |
指定 getkeyname 操作返回的服务名称。 |
type= {own | share | kernel | filesys | rec | adapt | interact type= {own | share}} |
指定服务类型。 选项包括:
|
start= {boot | system | auto | demand | disabled | delayed-auto} |
指定服务的启动类型。 选项包括:
|
error= {normal | severe | critical | ignore} |
如果在计算机启动时服务无法启动,则指定错误的严重性。 选项包括:
|
binpath= <binarypathname> |
指定服务二进制文件的路径。 Binpath =没有默认值,必须提供此字符串。 此外,可以在用于调试的字符串前面指定 ntsd 。 有关详细信息,请参阅 使用 CDB 和 NTSD 进行调试。 |
group= <loadordergroup> |
指定此服务所属的组的名称。 组列表存储在注册表的 HKLM\System\CurrentControlSet\Control\ServiceGroupOrder 子项中。 默认值为 null。 |
tag= {yes | no} |
指定是否从 CreateService 调用中获取 TagID。 标记仅用于启动和系统启动驱动程序。 |
depend= <dependencies> |
指定必须在此服务之前启动的服务或组的名称。 名称由正斜杠分隔 (/) 。 |
obj= {<accountname> | <objectname>} |
指定服务将在其中运行的帐户的名称,或指定将在其中运行该驱动程序的 Windows 驱动程序对象的名称。 默认设置为 LocalSystem。 |
displayname= <displayname> |
指定用于标识用户界面程序中的服务的描述性名称。 例如,一个特定服务的子项名称是 wuauserv,它具有更友好的显示名称自动更新。 |
password= <password> |
指定密码。 如果使用了除 LocalSystem 帐户之外的帐户,则这是必需的。 |
| /? | 在命令提示符下显示帮助。 |
注解
每个命令行选项 (参数) 必须包含等号作为选项名称的一部分。
选项与其值之间必须有一个空格 (例如, type =an。 如果省略此空间,则操作将失败。
示例
若要指定 NewService 服务的二进制路径,请键入:
sc.exe config NewService binpath= c:\windows\system32\NewServ.exe