大网数据广告活动
Windows排障命令

sc.exe create

· 52CE 我爱测

Reference article for the sc.exe create command, which creates a subkey and entries for a service in the registry and in the Service Control Manager database.

Creates a subkey and entries for a service in the registry and in the Service Control Manager database.

Syntax

sc.exe [<servername>] create [<servicename>] [type= {own | share | kernel | filesys | rec | 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>]

Parameters

Parameter Description
<servername> Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format (for example, \myserver). To run SC.exe locally, don't use this parameter.
<servicename> Specifies the service name returned by the getkeyname operation.
`type= {own share
`start= {boot system
`error= {normal severe
binpath= <binarypathname> Specifies a path to the service binary file. There is no default for binpath=, and this string must be supplied.
group= <loadordergroup> Specifies the name of the group of which this service is a member. The list of groups is stored in the registry, in the HKLM\System\CurrentControlSet\Control\ServiceGroupOrder subkey. The default value is null.
`tag= {yes no}`
depend= <dependencies> Specifies the names of services or groups that must start before this service. The names are separated by forward slashes (/).
`obj= {<accountname> <objectname>}`
displayname= <displayname> Specifies a friendly name for identifying the service in user interface programs. For example, the subkey name of one particular service is wuauserv, which has a more friendly display name of Automatic Updates.
password= <password> Specifies a password. This is required if an account other than the LocalSystem account is used.
/? Displays help at the command prompt.
Remarks
  • Each command-line option (parameter) must include the equal sign as part of the option name.

  • A space is required between an option and its value (for example, type= own. If the space is omitted, the operation fails.

Examples

To create and register a new binary path for the NewService service, type:

sc.exe \\myserver create NewService binpath= c:\windows\system32\NewServ.exe
sc.exe create NewService binpath= c:\windows\system32\NewServ.exe type= share start= auto depend= +TDI NetBIOS

To learn more about the sc.exe command, see SC commands.

Related links

Source: Microsoft Learn / Windows Server documentation by Microsoft and contributors (upstream author metadata: robinharwood). Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Server documentation
适用范围
Windows Server · Source date 09/29/2023
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。