参照网站:

参考网站:

CMD命令讲解(一)SC,cmd命令讲解sc

参照网站:

备注:网站内容是翻译得来,源网站在地点

 

与劳务控制器和已设置的劳务拓展通讯。exe检索和安装关于劳动的决定音信。您可以行使sc.exe来测试和调节服务程序。存储在注册表中的服务属性可以安装为操纵什么在运转时运行服务应用程序,并视作后台进度运维。exe参数可以配备特定的劳务,检索服务的此时此刻情景,以及截至和开行服务。您可以创立调用各个sc.exe命令的批处理公事,以自动化运转或关闭服务的逐一。exe提供类似于控制面板中的管理工具项中的服务的效率。

对此命令语法,请单击下边的别的一个sc命令:

sc boot

表示最终一个指点是或不是应该被封存为末段3个杰出的布署。

How to create a Windows service by using Sc.exe

  • Email
  • Print

Support for Windows XP has ended

Microsoft ended support for Windows XP on April 8, 2014. This change has
affected your software updates and security options. Learn what this
means for you and how to stay
protected.

Support for Windows Server 2003 ended on July 14, 2015

Microsoft ended support for Windows Server 2003 on July 14, 2015. This
change has affected your software updates and security options. Learn
what this means for you and how to stay
protected.

This article was previously published under Q251192

备注:网站内容是翻译得来,源网站在地点

备考:网站内容是翻译得来,源网站在地点

Syntax

sc [ServerNameboot [{bad|OK}]

SUMMARY

To remotely create and start a service from the command line, you can
use the SC tool (Sc.exe) included in the Resource Kit. 

Although you can use the Netsvc.exe and Instsrv.exe tools to start a
service on a remote computer, these tools do not give you the ability to
remotely create a service. 

Note The Srvinstw.exe tool is the graphical user
interface (GUI) version used to create remote services. Srvinstw.exe is
not a command-line tool.

 

 

Parameters

ServerName   点名服务所在的中距离服务器的称号。名称必须运用通用命名约定(UNC)格式(“myserver”)。要在地面运行sc.exe,请忽略这几个参数。

[{ bad | OK }] :点名最后贰个指引是坏的要么应当作为最终三个好的指导配置来保存。

/ ?在命令提醒符中突显帮助。

MORE INFORMATION

You can use Sc.exe to help develop services for Windows. Sc.exe, which
is provided in the Resource Kit, implements calls to all of the Windows
service control application programming interface (API) functions. You
can set the parameters to these functions by specifying them on the
command line. Sc.exe also displays service status and retrieves the
values stored in the status structure fields. The tool also lets you
specify the name of a remote computer so that you can call the service
API functions or view the service status structures on the remote
computer. 

Sc.exe also allows you to call any of the service control API functions
and vary any of the parameters from the command line. The advantage to
this is that it provides a convenient way to create or configure the
service information in the registry and the Service Control Manager
database. You do not have to configure the service by manually creating
entries in the registry and then restarting the computer to force the
Service Control Manager to update its database. 

Sc.exe uses the following syntax: 

Syntax1 (use Syntax1 to run Sc.exe)

sc [Servername] Command Servicename [Optionname= Optionvalue…]

Syntax2 (use Syntax2 to display help information, except for the query command)

sc [Command]

与劳动控制器和已安装的劳动开展通信。exe检索和装置关于劳动的操纵音讯。您可以使用sc.exe来测试和调剂服务程序。存储在注册表中的服务性质可以安装为控制什么在运营时运维服务应用程序,并视作后台进程运维。exe参数可以布署特定的劳动,检索服务的近期境况,以及截止和起步服务。您能够创立调用各样sc.exe命令的批处理文件,以自动化运转或关闭服务的逐条。exe提供类似于控制面板中的管理工具项中的服务的效率。

与劳务控制器和已安装的劳动举行通讯。exe检索和装置关于劳动的主宰音信。您可以利用sc.exe来测试和调试服务程序。存储在注册表中的服务性质可以设置为操纵什么在运营时运营服务应用程序,并作为后台进度运转。exe参数可以安顿特定的劳务,检索服务的此时此刻意况,以及截止和开行服务。您可以创立调用种种sc.exe命令的批处理公事,以自动化运营或关闭服务的依次。exe提供类似于控制面板中的管理工具项中的服务的成效。

Examples

下边的例子浮现了怎么采纳sc boot 命令:

sc boot ok 
sc boot bad

sc config 

在登记中央和服务控制管理器的数据库中修改服务条目标值。

Parameters

  • Servername
    Optional. Specifies the name of the server when you want to run the
    commands on a remote computer. The name must start with two
    backslash (\) characters (for example, \\myserver). To run Sc.exe
    on the local computer, do not supply this parameter.
  • Command
    Specifies the sc command. Note that many of
    the sc commands require administrative
    privileges on the specified computer. Sc.exe supports the following
    commands:
    Config
    Changes the configuration of a service (persistent). 

    Continue
    Sends a Continue control request to a service. 

    Control
    Sends a control to a service. 

    Create
    Creates a service (adds it to the registry). 

    Delete
    Deletes a service (from the registry). 

    EnumDepend
    Enumerates service dependencies. 

    GetDisplayName
    Obtains the DisplayName for a service. 

    GetKeyName
    Obtains the ServiceKeyName for a service. 

    Interrogate
    Sends an Interrogate control request to a service. 

    Pause
    Sends a Pause control request to a service. 

    qc
    Queries configuration for the service. For detailed information, see
    the reference section, “SC QC.” 

    Query
    Queries the status for a service, or enumerates the status for types
    of services. For detailed information, see the reference section,
    “SC QUERY.” 

    Start
    Starts a service 

    Stop
    Sends a Stop request to a
    service.

  • Servicename
    Specifies the name given to the Service key in the registry. Note
    that this is different from the display name (which is what you see
    with net start command and the Services tool
    in Control Panel. Sc.exe uses the service key name as the primary
    identifier for the service.

  • Optionname
    The Optionname and Optionvalue parameters allow you to specify the
    names and values of optional command parameters. Note that there is
    no space between the Optionname and the equal sign. You can supply
    none, one, or more optional parameters name and value pairs.
  • Optionvalue
    Specifies the value for the parameter named by Optionname. The range
    of valid values is often restricted for each Optionname. For a list
    of available values, request help for each command.

Many of the commands
require Administrator privileges. Make sure that you are an
administrator of the computer where the development is being
performed. 

The sc create command creates an entry for the
service in the registry and in the Service Control Manager database. 

Syntax

sc [Servername] create Servicename [Optionname= Optionvalue…

对此命令语法,请单击上面的其他三个sc命令:

对于命令语法,请单击上边的此外一个sc命令:

Syntax

sc [ServerNameconfig [ServiceName] [type= {own|share|kernel|filesys|rec|adapt|interact type= {own|share}}] [start={boot|system|auto|demand|disabled}] [error={normal|severe|critical|ignore}] [binpath= BinaryPathName] [group= LoadOrderGroup] [tag={yes|no}] [depend= dependencies] [obj= {AccountName|ObjectName}] [displayname= DisplayName] [password= Password]

Parameters

  • Servername
    Optional. Specifies the name of the server when you want to run the
    commands on a remote computer. The name must start with two
    backslash characters (for example, \\myserver). To run SC on the
    local computer, do not supply this parameter.
  • Servicename
    Specifies the name given to the service key in the registry. Note
    that this is different from the display name, which is what you see
    with net start and the Services tool in
    Control Panel. Sc.exe uses the service key name as the primary
    identifier for the service.
  • Optionname
    The Optionname and Optionvalue parameters allow you to specify the
    names and values of optional parameters. Note that there is no space
    between the Optionname and the equal sign. You can supply none, one,
    or more optional parameters name and value pairs. The sc query command supports the following
    values:OptionnameOptionvalue
    type=own, share, interact, kernel, filesys
    Type of service you want to create. Optionvalues include types used
    by drivers.
    (default = share) 

    start=boot, system, auto, demand, disabled
    Start type for the service. Option values include types used by
    drivers.
    (default = demand) 

    error=normal, severe, critical, ignore
    Severity of error if the service does not start during boot.
    (default = normal) 

    binPath=(string)
    Path name to the service binary file. There is no default for this
    parameter. This string must be supplied. 

    group=(string)
    Name of group which this service is a member of. The list of groups
    are stored in the registry under ServiceGroupOrder.
    (default = nothing) 

    tag=(string)
    If this string is set to “yes,” Sc.exe obtains a TagId from the
    CreateService call, however, Sc.exe does not display the tag.
    (default = nothing) 

    depend=(space separated string)
    Names of services or groups that must start before this service. 

    obj=(string)
    Name of account in which the service runs. For drivers, this is the
    Windows driver object name.
    (default = LocalSystem) 

    DisplayName=(string)
    A string that can be used by user-interface programs to identify the
    service. 

    password=(string)
    A password string. This is required if an account other than
    LocalSystem is
    used.

Optionvalue
Specifies the value for the parameter named by Optionname. See the
Optionname reference for a list of supported values. When a string is to
be input, the use of empty quotes means that an empty string is passed
in. Note that there is a space between OptionValue and the equal sign.

Note The sc
create command performs the operations of the CreateService API
function. 

The following example creates a registry entry for the service named
“NewService” on the computer called
\\remotecomputer:

sc \\remotecomputer create newservice binpath=
c:\nt\system32\newserv.exe

Note In Windows 2000, Windows XP, Windows Server 2003,
Windows Vista, and Windows Server 2008, the binpath is located at
C:\Windows\System32\Newserv.exe.

This service is created as a WIN32_SHARE_PROCESS with a
SERVICE_DEMAND_START start-type by default. It does not have any
dependencies, and runs in the LocalSystem security context. 

The following example creates the service on the local computer as an
auto-start service that runs in its own process. It has dependencies on
the TDI group and on the NetBIOS service. Notice that you must add
quotes around the list of space-separated
dependencies.

sc create newservice binpath= c:\nt\system32\newserv.exe type= own
start= auto depend= “+tdi netbios”

Note In Windows 2000, Windows XP, Windows Server 2003,
Windows Vista, and Windows Server 2008, the binpath is located at
C:\Windows\System32\Newserv.exe. 

For further details about the Sc.exe tool, please see the Sc-dev.txt
document in the Resource Kit. This document describes Sc.exe in greater
detail.

Properties

Article ID: 251192 – Last Review: 09/11/2011 06:54:00 – Revision: 6.0

Applies to

  • Microsoft Windows NT Server 3.51
  • Microsoft Windows NT Server 4.0 Standard Edition
  • Microsoft Windows 2000 Server
  • Microsoft Windows 2000 Advanced Server
  • Microsoft Windows 2000 Professional Edition
  • Microsoft Windows Server 2003, Datacenter Edition (32-bit x86)
  • Microsoft Windows Server 2003, Datacenter Edition for Itanium-Based
    Systems
  • Microsoft Windows Server 2003, Datacenter x64 Edition
  • Microsoft Windows Server 2003, Enterprise x64 Edition
  • Microsoft Windows Server 2003, Enterprise Edition (32-bit x86)
  • Microsoft Windows Server 2003, Enterprise Edition for Itanium-based
    Systems
  • Microsoft Windows Server 2003, Standard x64 Edition
  • Microsoft Windows Server 2003, Standard Edition (32-bit x86)
  • Windows Vista Home Basic
  • Windows Vista Home Basic N
  • Windows Vista Home Basic N 64-bit Edition
  • Windows Vista Business
  • Windows Vista Business 64-bit Edition
  • Windows Vista Business N
  • Windows Vista Business N 64-bit Edition
  • Windows Vista Home Premium
  • Windows Vista Home Basic 64-bit Edition
  • Windows Vista Home Premium 64-bit Edition
  • Windows Vista Ultimate
  • Windows Vista Ultimate 64-bit Edition
  • Microsoft Windows XP Home Edition
  • Microsoft Windows XP Professional
  • Windows Server 2008 Standard
  • Windows Server 2008 Enterprise
  • Windows Server 2008 Datacenter

Keywords:

  • kbhowto kbexpertiseinter kbinfo KB251192

sc boot

sc boot

Parameters

ServerName   : 指定服务所在的远距离服务器的名号。名称必须运用通用命名约定(UNC)格式(“myserver”)。要在当地运营sc.exe,请忽略那几个参数。

ServiceName   : 指定由getkeyname操作重临的劳务名称。

type= { own | share | kernel | filesys | rec | adapt | interact   type= { own | share }}   : 指定了服务类型。

Value

Description

own

服务运行在自己的进程中。它不与其他服务共享一个可执行文件。这是默认的。

share

该服务作为一个共享过程运行。它与其他服务共享一个可执行文件。

kernel

驱动程序

filesys

文件系统驱动程序。

rec

文件系统识别的驱动程序(识别计算机上使用的文件系统)。

adapt

适配器驱动程序(识别硬件项目,如键盘、鼠标和磁盘驱动器)。

interact

该服务可以与桌面交互,接收来自用户的输入。交互式服务必须在LocalSystem帐户下运行。

此类型必须与type= owntype= shared(例如,type= interact type= own)一起使用。

使用type= interact本身就会产生一个无效的参数错误。

start= { boot | system | auto | demand | disabled } : 指定服务的发端类型。

Value

Description

boot

由引导加载程序加载的设备驱动程序。

system

在内核初始化期间启动的设备驱动程序。

auto

一种服务,每当计算机重新启动并运行,即使没有人登录计算机,它也会自动启动。

demand

必须手动启动的服务。如果start=没有指定,那么这就是默认值。

disabled

无法启动的服务。要启动一个禁用的服务,将start类型更改为其他值。

error= { normal | severe | critical | ignore } : 即便服务在开行期间不大概运行,则指定错误的严重程度。

Value

Description

normal

错误会被记录,并且会显示一个消息框,通知用户一个服务没有启动。程序将继续下去。这是默认设置。

severe

错误被记录(如果可能的话)。计算机试图以最后一组良好的配置重新启动。这可能导致计算机能够重新启动,但是服务可能仍然无法运行。

critical

错误被记录(如果可能的话)。计算机试图以最后一组良好的配置重新启动。如果最后一个好的配置失败了,启动也会失败,引导过程会停止错误。

ignore

错误被记录,启动继续。除了记录事件日志中的错误之外,没有通知用户。

binpath=   cmd命令讲解sc,CMD命令讲解。BinaryPathName   : 指定服务二进制文件的门路。

group=   LoadOrderGroup   : 指定该服务为成员的组的称呼。组的列表存储在HKLM系统CurrentControlSet控制ServiceGroupOrder子键的注册表中。暗许为空。

tag= { yes | no } : 指定是不是从CreateService调用中获取三个TagID。标签只用于运转运营和系统运转驱动程序。

depend=   dependencies   : 指定必须在此服务从前运行的劳务或组的名号。名称由前斜杠(/)分隔开。

obj= { AccountName | ObjectName } :指定服务将运行的帐户的名称,或指定驱动程序运营的Windows驱动程序对象的名目。缺省值是LocalSystem。

displayname=   DisplayName   : 指定三个要好的、有含义的称谓,能够在用户界面程序中利用,以识别用户的服务。例如,三个服务的子键名是wuauserv,它对用户没有帮衬,突显名是自动更新。

password=   Password   : 指定二个密码。倘若使用的是LocalSystem帐户以外的帐户,则须要这么做。

/ ?在指令提醒符中呈现襄助。

表示最终一个辅导是或不是相应被封存为尾声2个美妙的布局。

表示最终二个引导是或不是合宜被封存为末段3个地道的安插。

Remarks

  • 尽管没有一个parameter 和
    value之间的上空(例如,type=属于自身,而不是项目=自个儿),操作就会失利。

Syntax

sc [ServerNameboot [{bad|OK}]

Syntax

sc [ServerNameboot [{bad|OK}]

Examples

上面的言传身教展现了怎么利用 sc config 命令:

sc config NewService binpath= “ntsd -d
c:\windows\system32\NewServ.exe”

sc continue

Sends a CONTINUE control request to a service in order to resume a
paused service.

Top of page 

Parameters

ServerName   指定服务所在的长途服务器的称呼。名称必须使用通用命名约定(UNC)格式(“myserver”)。要在地头运维sc.exe,请忽略那些参数。

[{ bad | OK }] :指定最终七个指导是坏的或然应该作为最后三个好的率领配置来保存。

/ ?在指令指示符中突显扶助。

Parameters

ServerName   点名服务所在的中距离服务器的称呼。名称必须运用通用命名约定(UNC)格式(“myserver”)。要在地面运维sc.exe,请忽略这么些参数。

[{ bad | OK }] :指定最后一个指导是坏的如故应该作为最终三个好的带领配置来保存。

/ ?在命令指示符中突显帮忙。

Syntax

sc [ServerNamecontinue [ServiceName]

Top of page 

Examples

上面的例子浮现了怎么接纳sc boot 命令:

sc boot ok 
sc boot bad

sc config 

在登记中央和服务控制管理器的数据库中修改服务条目标值。

Examples

上边的事例展现了怎么着使用sc boot 命令:

sc boot ok 
sc boot bad

sc config 

在登记核心和劳动控制管理器的数据库中修改服务条目标值。

Parameters

ServerName   : 指定服务所在的长距离服务器的称谓。名称必须运用通用命名约定(UNC)格式(“myserver”)。要在当地运维sc.exe,请忽略这一个参数。

ServiceName   Specifies the service name returned by
the getkeyname operation.

/? Displays help at the command prompt.

Top of page 

Syntax

sc [ServerNameconfig [ServiceName] [type= {own|share|kernel|filesys|rec|adapt|interact type= {own|share}}] [start={boot|system|auto|demand|disabled}] [error={normal|severe|critical|ignore}] [binpath= BinaryPathName] [group= LoadOrderGroup] [tag={yes|no}] [depend= dependencies] [obj= {AccountName|ObjectName}] [displayname= DisplayName] [password= Password]

Syntax

sc [ServerNameconfig [ServiceName] [type= {own|share|kernel|filesys|rec|adapt|interact type= {own|share}}] [start={boot|system|auto|demand|disabled}] [error={normal|severe|critical|ignore}] [binpath= BinaryPathName] [group= LoadOrderGroup] [tag={yes|no}] [depend= dependencies] [obj= {AccountName|ObjectName}] [displayname= DisplayName] [password= Password]

Remarks

  • Use the continue operation to resume a paused service.

Top of page 

Parameters

ServerName   : 指定服务所在的长途服务器的名称。名称必须接纳通用命名约定(UNC)格式(“myserver”)。要在当地运转sc.exe,请忽略那个参数。

ServiceName   : 指定由getkeyname操作重回的劳务名称。

type= { own | share | kernel | filesys | rec | adapt | interact   type= { own | share }}   : 指定了服务类型。

Value

Description

own

服务运行在自己的进程中。它不与其他服务共享一个可执行文件。这是默认的。

share

该服务作为一个共享过程运行。它与其他服务共享一个可执行文件。

kernel

驱动程序

filesys

文件系统驱动程序。

rec

文件系统识别的驱动程序(识别计算机上使用的文件系统)。

adapt

适配器驱动程序(识别硬件项目,如键盘、鼠标和磁盘驱动器)。

interact

该服务可以与桌面交互,接收来自用户的输入。交互式服务必须在LocalSystem帐户下运行。

此类型必须与type= owntype= shared(例如,type= interact type= own)一起使用。

使用type= interact本身就会产生一个无效的参数错误。

start= { boot | system | auto | demand | disabled } : 指定服务的发轫类型。

Value

Description

boot

由引导加载程序加载的设备驱动程序。

system

在内核初始化期间启动的设备驱动程序。

auto

一种服务,每当计算机重新启动并运行,即使没有人登录计算机,它也会自动启动。

demand

必须手动启动的服务。如果start=没有指定,那么这就是默认值。

disabled

无法启动的服务。要启动一个禁用的服务,将start类型更改为其他值。

error= { normal | severe | critical | ignore } : 即使服务在起步时期不或者运营,则指定错误的严重程度。

Value

Description

normal

错误会被记录,并且会显示一个消息框,通知用户一个服务没有启动。程序将继续下去。这是默认设置。

severe

错误被记录(如果可能的话)。计算机试图以最后一组良好的配置重新启动。这可能导致计算机能够重新启动,但是服务可能仍然无法运行。

critical

错误被记录(如果可能的话)。计算机试图以最后一组良好的配置重新启动。如果最后一个好的配置失败了,启动也会失败,引导过程会停止错误。

ignore

错误被记录,启动继续。除了记录事件日志中的错误之外,没有通知用户。

binpath=   BinaryPathName   : 指定服务二进制文件的门径。

group=   LoadOrderGroup   : 指定该服务为成员的组的名号。组的列表存储在HKLM系统CurrentControlSet控制瑟维斯GroupOrder子键的注册表中。私自认同为空。

tag= { yes | no } : 指定是或不是从CreateService调用中赢得三个TagID。标签只用于运行运营和系统运营驱动程序。

depend=   dependencies   : 指定必须在此服务以前运维的劳务或组的称谓。名称由前斜杠(/)分隔开。

obj= { AccountName | ObjectName } :指定服务将运转的帐户的称号,或指定驱动程序运转的Windows驱动程序对象的称呼。缺省值是LocalSystem。

displayname=   DisplayName   : 指定二个温馨的、有含义的称号,可以在用户界面程序中利用,以识别用户的劳务。例如,一个劳动的子键名是wuauserv,它对用户没有帮忙,突显名是自动更新。

password=   Password   : 指定贰个密码。假如运用的是LocalSystem帐户以外的帐户,则要求如此做。

/ ?在指令指示符中展现帮衬。

Parameters

ServerName   : 指定服务所在的长距离服务器的称谓。名称必须运用通用命名约定(UNC)格式(“myserver”)。要在地头运维sc.exe,请忽略这么些参数。

ServiceName   : 指定由getkeyname操作重返的服务名称。

type= { own | share | kernel | filesys | rec | adapt | interact   type= { own | share }}   : 指定了服务类型。

Value

Description

own

服务运行在自己的进程中。它不与其他服务共享一个可执行文件。这是默认的。

share

该服务作为一个共享过程运行。它与其他服务共享一个可执行文件。

kernel

驱动程序

filesys

文件系统驱动程序。

rec

文件系统识别的驱动程序(识别计算机上使用的文件系统)。

adapt

适配器驱动程序(识别硬件项目,如键盘、鼠标和磁盘驱动器)。

interact

该服务可以与桌面交互,接收来自用户的输入。交互式服务必须在LocalSystem帐户下运行。

此类型必须与type= owntype= shared(例如,type= interact type= own)一起使用。

使用type= interact本身就会产生一个无效的参数错误。

start= { boot | system | auto | demand | disabled } : 指定服务的启幕类型。

Value

Description

boot

由引导加载程序加载的设备驱动程序。

system

在内核初始化期间启动的设备驱动程序。

auto

一种服务,每当计算机重新启动并运行,即使没有人登录计算机,它也会自动启动。

demand

必须手动启动的服务。如果start=没有指定,那么这就是默认值。

disabled

无法启动的服务。要启动一个禁用的服务,将start类型更改为其他值。

error= { normal | severe | critical | ignore } : 如若服务在运营时期不大概开行,则指定错误的要紧程度。

Value

Description

normal

错误会被记录,并且会显示一个消息框,通知用户一个服务没有启动。程序将继续下去。这是默认设置。

severe

错误被记录(如果可能的话)。计算机试图以最后一组良好的配置重新启动。这可能导致计算机能够重新启动,但是服务可能仍然无法运行。

critical

错误被记录(如果可能的话)。计算机试图以最后一组良好的配置重新启动。如果最后一个好的配置失败了,启动也会失败,引导过程会停止错误。

ignore

错误被记录,启动继续。除了记录事件日志中的错误之外,没有通知用户。

binpath=   BinaryPathName   : 指定服务二进制文件的不二法门。

group=   LoadOrderGroup   : 指定该服务为成员的组的名目。组的列表存储在HKLM系统CurrentControlSet控制ServiceGroupOrder子键的注册表中。暗中同意为空。

tag= { yes | no } : 指定是还是不是从CreateService调用中拿到2个TagID。标签只用于运营运维和系统运转驱动程序。

depend=   dependencies   : 指定必须在此服务从前运行的劳动或组的名称。名称由前斜杠(/)分隔开。

obj= { AccountName | ObjectName } :指定服务将运营的帐户的称谓,或指定驱动程序运维的Windows驱动程序对象的名称。缺省值是LocalSystem。

displayname=   DisplayName   : 指定三个要好的、有含义的称谓,能够在用户界面程序中利用,以识别用户的劳动。例如,3个服务的子键名是wuauserv,它对用户没有协助,呈现名是自动更新。

password=   Password   : 指定2个密码。尽管使用的是LocalSystem帐户以外的帐户,则要求这么做。

/ ?在指令提醒符中呈现帮忙。

Examples

The following example shows how you can use the sc continue command:

sc continue tapisrv

sc control

Sends a CONTROL B to a service.

Top of page 

Remarks

  • 借使没有二个parameter 和
    value之间的长空(例如,type=属于本身,而不是连串=自己),操作就会破产。

Remarks

  • 一经没有三个parameter 和
    value之间的半空中(例如,type=属于自个儿,而不是项目=自个儿),操作就会战败。

Syntax

sc[ServerNamecontrol [ServiceName] [{paramchange|netbindadd|netbindremove|netbindenable|netbinddisable|UserDefinedControlB}]

Top of page 

Examples

下边的以身作则体现了如何行使 sc config 命令:

sc config NewService binpath= “ntsd -d
c:\windows\system32\NewServ.exe”

sc continue

Sends a CONTINUE control request to a service in order to resume a
paused service.

Top of
page 

Examples

下边的演示浮现了什么利用 sc config 命令:

sc config NewService binpath= “ntsd -d
c:\windows\system32\NewServ.exe”

sc continue

Sends a CONTINUE control request to a service in order to resume a
paused service.

Top of
page 

Parameters

ServerName   : 指定服务所在的远程服务器的名称。名称必须利用通用命名约定(UNC)格式(“myserver”)。要在当地运转sc.exe,请忽略这些参数。

ServiceName   Specifies the service name returned by
the getkeyname operation.

{ paramchange | netbindadd | netbindremove | netbindenable | netbinddisable | UserDefinedControlB } : Specifies
a control to send to a service.

/? Displays help at the command prompt.

sc create

在注册核心和劳动控制管理器的数据库中为劳动创立多个子键和条文。

Syntax

sc [ServerNamecontinue [ServiceName]

Top of
page 

Syntax

sc [ServerNamecontinue [ServiceName]

Top of
page 

Syntax

sc [ServerNamecreate [ServiceName] [type= {own|share|kernel|filesys|rec|adapt|interact type= {own|share}}] [start={boot|system|auto|demand|disabled}] [error={normal|severe|critical|ignore}] [binpath= BinaryPathName] [group= LoadOrderGroup] [tag={yes|no}] [depend= dependencies] [obj= {AccountName|ObjectName}] [displayname= DisplayName] [password= Password]

Parameters

ServerName   : 指定服务所在的长距离服务器的称谓。名称必须利用通用命名约定(UNC)格式(“myserver”)。要在地头运转sc.exe,请忽略那一个参数。

ServiceName   Specifies the service name returned by
the getkeyname operation.

/? Displays help at the command prompt.

Top of
page 

Parameters

ServerName   : 指定服务所在的长途服务器的称谓。名称必须运用通用命名约定(UNC)格式(“myserver”)。要在地面运维sc.exe,请忽略这些参数。

ServiceName   Specifies the service name returned by
the getkeyname operation.

/? Displays help at the command prompt.

Top of
page 

Parameters

ServerName   : 指定服务所在的长距离服务器的称谓。名称必须接纳通用命名约定(UNC)格式(“myserver”)。要在地方运转sc.exe,请忽略这些参数。

ServiceName   : 指定由getkeyname操作重回的劳务名称。

type= { own | share | kernel | filesys | rec | adapt | interact   type= { own | share }}   : 指定了服务类型. 默许的门类 own.

Value

Description

own

服务运行在自己的进程中。它不与其他服务共享一个可执行文件。这是默认的。

share

该服务作为一个共享过程运行。它与其他服务共享一个可执行文件。

kernel

驱动程序

filesys

文件系统驱动程序。

rec

文件系统识别的驱动程序(识别计算机上使用的文件系统)。

interact

该服务可以与桌面交互,接收来自用户的输入。交互式服务必须在LocalSystem帐户下运行。

此类型必须与type= owntype= shared(例如,type= interact type= own)一起使用。

使用type= interact本身就会产生一个无效的参数错误。

start= { boot | system | auto | demand | disabled } : 指定服务的初步类型。暗中同意的起来是 start= demand.

   

boot

由引导加载程序加载的设备驱动程序。

system

在内核初始化期间启动的设备驱动程序。

auto

一种服务,每当计算机重新启动并运行,即使没有人登录计算机,它也会自动启动。

demand

必须手动启动的服务。这是默认值start没有指定。

disabled

无法启动的服务。要启动一个禁用的服务,将start类型更改为其他值。

error= { normal | severe | critical | ignore } : 如若服务在起步时期不大概运转,则指定错误的要紧程度。默许值是error= normal.

   

normal

错误会被记录,并且会显示一个消息框,通知用户一个服务没有启动。公司将继续下去。这是默认设置。

severe

错误被记录(如果可能的话)。计算机试图以最后一组良好的配置重新启动。这可能导致计算机能够重新启动,但是服务可能仍然无法运行。

critical

错误被记录(如果可能的话)。计算机试图以最后一组良好的配置重新启动。如果最后一个好的配置失败了,启动也会失败,引导过程会停止错误。

ignore

错误被记录,启动继续。除了记录事件日志中的错误之外,没有通知用户。

binpath=   BinaryPathName   : 指定服务二进制文件的路径。没有暗中同意值 ,binpath本条字符串必须提供.

group=   LoadOrderGroup   :指定该服务为成员的组的称呼。组的列表存储在注册表中 HKLM\System\CurrentControlSet\Control\ServiceGroupOrder
subkey. 暗许为空。

tag= { yes | no } : 指定是不是从CreateService调用中拿到多少个TagID。标签只用于运维运转和系统运行驱动程序。

depend=   dependencies   : 指定必须在此服务在此以前运转的服务或组的名号。名称由前斜杠(/)分隔开。

obj= { AccountName | ObjectName } : 指定服务将运营的帐户的名称,或指定驱动程序运转的Windows驱动程序对象的名目。

displayname=   DisplayName   : 指定一个投机的称呼,用户界面程序可以应用它来标识服务。

password=   Password   : 指定二个密码。即便利用的是LocalSystem以外的帐户,则必要这样做。

/? : 在指令指示符中显示扶助。 

Remarks

  • Use the continue operation to resume a paused service.

Top of
page 

Remarks

  • Use the continue operation to resume a paused service.

Top of
page 

Remarks

  • 尚未参数和值时期的空格操作将会战败(正确:type= own,
    错误:type=own),

Examples

The following example shows how you can use the sc continue command:

sc continue tapisrv

sc control

Sends a CONTROL B to a service.

Top of
page 

Examples

The following example shows how you can use the sc continue command:

sc continue tapisrv

sc control

Sends a CONTROL B to a service.

Top of
page 

Examples

上边的例子显示了怎么样运用 sc create 命令:

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

sc create ServerWCF binPath=
“F:/SalesAndSalesManagement/ServerWCF/bin/Release/ServerWCF.exe” TYPE=
“own” start= “auto” TAG= “no” DisplayName= “ServerWCF”

 

sc delete

从注册表中删去服务子键。假若服务正在运营,恐怕另3个进度对劳动有一个开辟的句柄,那么该服务将被标记为除去。

Syntax

sc[ServerNamecontrol [ServiceName] [{paramchange|netbindadd|netbindremove|netbindenable|netbinddisable|UserDefinedControlB}]

Top of
page 

Syntax

sc[ServerNamecontrol [ServiceName] [{paramchange|netbindadd|netbindremove|netbindenable|netbinddisable|UserDefinedControlB}]

Top of
page 

Syntax

sc [ServerNamedelete [ServiceName]

Parameters

ServerName   : 指定服务所在的中远距离服务器的名号。名称必须采取通用命名约定(UNC)格式(“myserver”)。要在位置运转sc.exe,请忽略那一个参数。

ServiceName   Specifies the service name returned by
the getkeyname operation.

{ paramchange | netbindadd | netbindremove | netbindenable | netbinddisable | UserDefinedControlB } : Specifies
a control to send to a service.

/? Displays help at the command prompt.

sc create

在登记大旨和劳务控制管理器的数据库中为劳动创设3个子键和条文。

Parameters

ServerName   : 指定服务所在的长途服务器的名目。名称必须选取通用命名约定(UNC)格式(“myserver”)。要在本土运转sc.exe,请忽略那个参数。

ServiceName   Specifies the service name returned by
the getkeyname operation.

{ paramchange | netbindadd | netbindremove | netbindenable | netbinddisable | UserDefinedControlB } : Specifies
a control to send to a service.

/? Displays help at the command prompt.

sc create

在登记大旨和服务控制管理器的数据库中为服务成立一个子键和条款。

Parameters

ServerName   : 指定服务所在的长距离服务器的称谓。名称必须运用UNC格式(“myserver”)。要在地点运维sc.exe,请忽略那么些参数。

ServiceName   : 指定由该服务重回的服务名称 getkeyname 操作.

/? :在命令提醒符中突显协助。

Syntax

sc [ServerNamecreate [ServiceName] [type= {own|share|kernel|filesys|rec|adapt|interact type= {own|share}}] [start={boot|system|auto|demand|disabled}] [error={normal|severe|critical|ignore}] [binpath= BinaryPathName] [group= LoadOrderGroup] [tag={yes|no}] [depend= dependencies] [obj= {AccountName|ObjectName}] [displayname= DisplayName] [password= Password]

Syntax

sc [ServerNamecreate [ServiceName] [type= {own|share|kernel|filesys|rec|adapt|interact type= {own|share}}] [start={boot|system|auto|demand|disabled}] [error={normal|severe|critical|ignore}] [binpath= BinaryPathName] [group= LoadOrderGroup] [tag={yes|no}] [depend= dependencies] [obj= {AccountName|ObjectName}] [displayname= DisplayName] [password= Password]

Remarks

  • 行使添加或删除程序来删除DHCP、DNS或此外其余内置的操作系统服务。添加或删除程序不仅会去除服务的挂号表子键,还会卸载服务并删除服务的其他飞快格局。

Parameters

ServerName   : 指定服务所在的远程服务器的称呼。名称必须使用通用命名约定(UNC)格式(“myserver”)。要在本地运转sc.exe,请忽略那些参数。

ServiceName   : 指定由getkeyname操作再次来到的劳务名称。

type= { own | share | kernel | filesys | rec | adapt | interact   type= { own | share }}   : 指定了劳务类型. 暗许的种类 own.

Value

Description

own

服务运行在自己的进程中。它不与其他服务共享一个可执行文件。这是默认的。

share

该服务作为一个共享过程运行。它与其他服务共享一个可执行文件。

kernel

驱动程序

filesys

文件系统驱动程序。

rec

文件系统识别的驱动程序(识别计算机上使用的文件系统)。

interact

该服务可以与桌面交互,接收来自用户的输入。交互式服务必须在LocalSystem帐户下运行。

此类型必须与type= owntype= shared(例如,type= interact type= own)一起使用。

使用type= interact本身就会产生一个无效的参数错误。

start= { boot | system | auto | demand | disabled } : 指定服务的始发类型。暗中认同的初叶是 start= demand.

   

boot

由引导加载程序加载的设备驱动程序。

system

在内核初始化期间启动的设备驱动程序。

auto

一种服务,每当计算机重新启动并运行,即使没有人登录计算机,它也会自动启动。

demand

必须手动启动的服务。这是默认值start没有指定。

disabled

无法启动的服务。要启动一个禁用的服务,将start类型更改为其他值。

error= { normal | severe | critical | ignore } : 尽管服务在运行时期无法运维,则指定错误的沉痛程度。暗中同意值是error= normal.

   

normal

错误会被记录,并且会显示一个消息框,通知用户一个服务没有启动。公司将继续下去。这是默认设置。

severe

错误被记录(如果可能的话)。计算机试图以最后一组良好的配置重新启动。这可能导致计算机能够重新启动,但是服务可能仍然无法运行。

critical

错误被记录(如果可能的话)。计算机试图以最后一组良好的配置重新启动。如果最后一个好的配置失败了,启动也会失败,引导过程会停止错误。

ignore

错误被记录,启动继续。除了记录事件日志中的错误之外,没有通知用户。

binpath=   BinaryPathName   : 指定服务二进制文件的门路。没有默许值 ,binpath其一字符串必须提供.

group=   LoadOrderGroup   :指定该服务为成员的组的名目。组的列表存储在注册表中 HKLM\System\CurrentControlSet\Control\ServiceGroupOrder
subkey. 暗中同意为空。

tag= { yes | no } : 指定是还是不是从CreateService调用中赢得二个TagID。标签只用于运转运营和系统运维驱动程序。

depend=   dependencies   : 指定必须在此服务在此之前启动的劳动或组的名称。名称由前斜杠(/)分隔开。

obj= { AccountName | ObjectName } : 指定服务将运转的帐户的称呼,或指定驱动程序运转的Windows驱动程序对象的称谓。

displayname=   DisplayName   : 指定3个融洽的名号,用户界面程序可以拔取它来标识服务。

password=   Password   : 指定3个密码。要是使用的是LocalSystem以外的帐户,则须要这么做。

/? : 在指令指示符中突显支持。 

Parameters

ServerName   : 指定服务所在的远程服务器的名目。名称必须利用通用命名约定(UNC)格式(“myserver”)。要在本地运营sc.exe,请忽略这么些参数。

ServiceName   : 指定由getkeyname操作重返的劳动名称。

type= { own | share | kernel | filesys | rec | adapt | interact   type= { own | share }}   : 指定了劳务类型. 暗中认可的档次 own.

Value

Description

own

服务运行在自己的进程中。它不与其他服务共享一个可执行文件。这是默认的。

share

该服务作为一个共享过程运行。它与其他服务共享一个可执行文件。

kernel

驱动程序

filesys

文件系统驱动程序。

rec

文件系统识别的驱动程序(识别计算机上使用的文件系统)。

interact

该服务可以与桌面交互,接收来自用户的输入。交互式服务必须在LocalSystem帐户下运行。

此类型必须与type= owntype= shared(例如,type= interact type= own)一起使用。

使用type= interact本身就会产生一个无效的参数错误。

start= { boot | system | auto | demand | disabled } : 指定服务的初始类型。暗许的起首是 start= demand.

   

boot

由引导加载程序加载的设备驱动程序。

system

在内核初始化期间启动的设备驱动程序。

auto

一种服务,每当计算机重新启动并运行,即使没有人登录计算机,它也会自动启动。

demand

必须手动启动的服务。这是默认值start没有指定。

disabled

无法启动的服务。要启动一个禁用的服务,将start类型更改为其他值。

error= { normal | severe | critical | ignore } : 即使服务在运维时期不可以运维,则指定错误的不得了程度。专断认同值是error= normal.

   

normal

错误会被记录,并且会显示一个消息框,通知用户一个服务没有启动。公司将继续下去。这是默认设置。

severe

错误被记录(如果可能的话)。计算机试图以最后一组良好的配置重新启动。这可能导致计算机能够重新启动,但是服务可能仍然无法运行。

critical

错误被记录(如果可能的话)。计算机试图以最后一组良好的配置重新启动。如果最后一个好的配置失败了,启动也会失败,引导过程会停止错误。

ignore

错误被记录,启动继续。除了记录事件日志中的错误之外,没有通知用户。

binpath=   BinaryPathName   : 指定服务二进制文件的不二法门。没有暗中认同值 ,binpath这么些字符串必须提供.

group=   LoadOrderGroup   :指定该服务为成员的组的称谓。组的列表存储在注册表中 HKLM\System\CurrentControlSet\Control\ServiceGroupOrder
subkey. 默许为空。

tag= { yes | no } : 指定是或不是从CreateService调用中拿走1个TagID。标签只用于运营运维和系统运转驱动程序。

depend=   dependencies   : 指定必须在此服务从前运转的服务或组的称呼。名称由前斜杠(/)分隔开。

obj= { AccountName | ObjectName } : 指定服务将运维的帐户的名号,或指定驱动程序运维的Windows驱动程序对象的称号。

displayname=   DisplayName   : 指定2个要好的名称,用户界面程序可以动用它来标识服务。

password=   Password   : 指定1个密码。若是拔取的是LocalSystem以外的帐户,则须要如此做。

/? : 在指令提醒符中突显辅助。 

Examples

下边的演示显示了怎么样运用 sc delete 命令:

sc delete newserv

 

sc description

为服务设置描述字符串。

Remarks

  • 从未参数和值时期的空格操作将会破产(正确:type= own,
    错误:type=own),

Remarks

  • 并未参数和值时期的空格操作将会战败(正确:type= own,
    错误:type=own),

Syntax

sc [ServerNamedescription [ServiceName]
[Description]

Top of page 

Examples

下边的例证显示了哪些行使 sc create 命令:

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

sc create ServerWCF binPath=
“F:/SalesAndSalesManagement/ServerWCF/bin/Release/ServerWCF.exe” TYPE=
“own” start= “auto” TAG= “no” DisplayName= “ServerWCF”

 

sc delete

从注册表中删除服务子键。如果服务正在运作,或然另三个历程对服务有七个开拓的句柄,那么该服务将被标记为除去。

Examples

上面的例证体现了什么样利用 sc create 命令:

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

sc create ServerWCF binPath=
“F:/SalesAndSalesManagement/ServerWCF/bin/Release/ServerWCF.exe” TYPE=
“own” start= “auto” TAG= “no” DisplayName= “ServerWCF”

 

sc delete

从注册表中删去服务子键。要是服务正在周转,恐怕另一个历程对劳动有1个开拓的句柄,那么该服务将被标记为除去。

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

Description   Specifies a description for the specified
service. If no string is specified, the description of the service is
not modified. There is no limit to the number of characters that can be
contained in the service description.

/? Displays help at the command prompt.

Top of page 

Syntax

sc [ServerNamedelete [ServiceName]

Syntax

sc [ServerNamedelete [ServiceName]

Examples

The following example shows how you can use the sc
description
 command:

sc description newserv “Runs quality of service control.”

sc enumdepend

Lists the services that cannot run unless the specified service is
running.

Top of page 

Parameters

ServerName   : 指定服务所在的远程服务器的名号。名称必须利用UNC格式(“myserver”)。要在当地运维sc.exe,请忽略那一个参数。

ServiceName   : 指定由该服务重返的劳动名称 getkeyname 操作.

/? :在命令提醒符中显示支持。

Parameters

ServerName   : 指定服务所在的中远距离服务器的名称。名称必须使用UNC格式(“myserver”)。要在地面运维sc.exe,请忽略这么些参数。

ServiceName   : 指定由该服务重临的劳务名称 getkeyname 操作.

/? :在指令指示符中突显帮忙。

Syntax

sc [ServerNameenumdepend [ServiceName] [BufferSize]

Top of page 

Remarks

  • 使用添加或删除程序来删除DHCP、DNS或任何别的内置的操作系统服务。添加或删除程序不仅会删除服务的登记表子键,还会卸载服务并剔除服务的其余赶快格局。

Remarks

  • 动用添加或删除程序来删除DHCP、DNS或任何别的内置的操作系统服务。添加或删除程序不仅会删除服务的注册表子键,还会卸载服务并剔除服务的其他飞快格局。

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

BufferSize   Specifies the size (in bytes) of the
enumeration buffer. The default is 1024 bytes.

/? Displays help at the command prompt.

Top of page 

Examples

上面的示范展现了哪些运用 sc delete 命令:

sc delete newserv

 

sc description

为劳动设置描述字符串。

Examples

下边的示范浮现了何等利用 sc delete 命令:

sc delete newserv

 

sc description

为劳动设置描述字符串。

Remarks

  • If the buffer is not big enough, the enumdepend operation will
    output dependencies only partially, and will specify the additional
    buffer size required to output all dependencies. If the output is
    truncated, rerun the operation and specify the larger buffer size.

Top of page 

Syntax

sc [ServerNamedescription [ServiceName]
[Description]

Top of
page 

Syntax

sc [ServerNamedescription [ServiceName]
[Description]

Top of
page 

Examples

The following examples show how you can use the sc
enumdepend
 command:

sc enumdepend rpcss 5690 
sc enumdepend tapisrv

sc failure

Specifies what action to take upon failure of the service.

Top of page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

Description   Specifies a description for the specified
service. If no string is specified, the description of the service is
not modified. There is no limit to the number of characters that can be
contained in the service description.

/? Displays help at the command prompt.

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

Description   Specifies a description for the specified
service. If no string is specified, the description of the service is
not modified. There is no limit to the number of characters that can be
contained in the service description.

/? Displays help at the command prompt.

Top of
page 

Syntax

sc [ServerNamefailure [ServiceName] [reset= ErrorFreePeriod] [reboot= BroadcastMessage] [command= CommandLine] [actions= FailureActionsAndDelayTime]

Top of page 

Examples

The following example shows how you can use the sc
description
 command:

sc description newserv “Runs quality of service control.”

sc enumdepend

Lists the services that cannot run unless the specified service is
running.

Top of
page 

Examples

The following example shows how you can use the sc
description
 command:

sc description newserv “Runs quality of service control.”

sc enumdepend

Lists the services that cannot run unless the specified service is
running.

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

reset=   ErrorFreePeriod   Specifies the length of
the period (in seconds) with no failures after which the failure count
should be reset to 0. This parameter must be used in conjunction with
the actions= parameter.

reboot=   BroadcastMessage   Specifies the message
to be broadcast upon failure of the service.

command=   CommandLine   Specifies the command line
to be run upon failure of the service. For more information about how to
run a batch or VBS file upon failure, see Remarks.

actions=   FailureActionsAndDelayTime   Specifies
the failure actions and their delay time (in milliseconds) separated by
the forward slash (/). The following actions are
valid: runrestart, and reboot. This parameter must be used
in conjunction with the reset=parameter. Use actions= “” to take
no action upon failure.

/? Displays help at the command prompt.

Top of page 

Syntax

sc [ServerNameenumdepend [ServiceName] [BufferSize]

Top of
page 

Syntax

sc [ServerNameenumdepend [ServiceName] [BufferSize]

Top of
page 

Remarks

  • Not all services allow changes to their failure options. Some run as
    part of a service set.

  • To run a batch file upon failure,
    specify cmd**.exe Drive:\FileName.bat to
    the 
    command= parameter, where Drive:\FileName.bat**is
    the fully qualified name of the batch file.

  • To run a VBS file upon failure, specify cscript
    drive**
    :\myscript.vbs to the command= parameter,
    where drive
    :\myscript.vbs** is the fully qualified name
    of the script file.

  • It is possible to specify three different actions to
    the actions= parameter, which will be used the first, second,
    and third time a service fails.

  • Without a space between a parameter and its value (that is, type=
    own
    , not type=own), the operation will fail.

Top of page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

BufferSize   Specifies the size (in bytes) of the
enumeration buffer. The default is 1024 bytes.

/? Displays help at the command prompt.

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

BufferSize   Specifies the size (in bytes) of the
enumeration buffer. The default is 1024 bytes.

/? Displays help at the command prompt.

Top of
page 

Examples

The following examples show how you can use the sc failure command:

sc failure msftpsvc reset= 30 actions= restart/5000 
sc failure dfs reset= 60 command=
c:\windows\services\restart_dfs.exe actions= run/5000
 
sc failure dfs reset= 60 actions= reboot/30000 
sc failure dfs reset= 60 reboot= “The Distributed File System service
has failed. Because of this, the computer will reboot in 30 seconds.”
actions= reboot/30000
 
sc failure myservice reset= 3600 reboot= “MyService crashed —
rebooting machine” command= “
 %windir%\MyServiceRecovery.exe”
actions= restart/5000/run/10000/reboot/60000

sc getdisplayname

Gets the display name associated with a particular service.

Top of page 

Remarks

  • If the buffer is not big enough, the enumdepend operation will
    output dependencies only partially, and will specify the additional
    buffer size required to output all dependencies. If the output is
    truncated, rerun the operation and specify the larger buffer size.

Top of
page 

Remarks

  • If the buffer is not big enough, the enumdepend operation will
    output dependencies only partially, and will specify the additional
    buffer size required to output all dependencies. If the output is
    truncated, rerun the operation and specify the larger buffer size.

Top of
page 

Syntax

sc [ServerNamegetdisplayname [ServiceName] [BufferSize]

Top of page 

Examples

The following examples show how you can use the sc
enumdepend
 command:

sc enumdepend rpcss 5690 
sc enumdepend tapisrv

sc failure

Specifies what action to take upon failure of the service.

Top of
page 

Examples

The following examples show how you can use the sc
enumdepend
 command:

sc enumdepend rpcss 5690 
sc enumdepend tapisrv

sc failure

Specifies what action to take upon failure of the service.

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

BufferSize   Specifies the size (in bytes) of the buffer.
The default is 1024 bytes.

/? Displays help at the command prompt.

Top of page 

Syntax

sc [ServerNamefailure [ServiceName] [reset= ErrorFreePeriod] [reboot= BroadcastMessage] [command= CommandLine] [actions= FailureActionsAndDelayTime]

Top of
page 

Syntax

sc [ServerNamefailure [ServiceName] [reset= ErrorFreePeriod] [reboot= BroadcastMessage] [command= CommandLine] [actions= FailureActionsAndDelayTime]

Top of
page 

Examples

The following examples show how you can use the sc
getdisplayname
 command:

sc getdisplayname clipsrv 
sc getdisplayname tapisrv 
sc getdisplayname sharedaccess

sc getkeyname

Gets the key name associated with a particular service, using the
display name as input.

Top of page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

reset=   ErrorFreePeriod   Specifies the length of
the period (in seconds) with no failures after which the failure count
should be reset to 0. This parameter must be used in conjunction with
the actions= parameter.

reboot=   BroadcastMessage   Specifies the message
to be broadcast upon failure of the service.

command=   CommandLine   Specifies the command line
to be run upon failure of the service. For more information about how to
run a batch or VBS file upon failure, see Remarks.

actions=   FailureActionsAndDelayTime   Specifies
the failure actions and their delay time (in milliseconds) separated by
the forward slash (/). The following actions are
valid: runrestart, and reboot. This parameter must be used
in conjunction with the reset=parameter. Use actions= “” to take
no action upon failure.

/? Displays help at the command prompt.

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

reset=   ErrorFreePeriod   Specifies the length of
the period (in seconds) with no failures after which the failure count
should be reset to 0. This parameter must be used in conjunction with
the actions= parameter.

reboot=   BroadcastMessage   Specifies the message
to be broadcast upon failure of the service.

command=   CommandLine   Specifies the command line
to be run upon failure of the service. For more information about how to
run a batch or VBS file upon failure, see Remarks.

actions=   FailureActionsAndDelayTime   Specifies
the failure actions and their delay time (in milliseconds) separated by
the forward slash (/). The following actions are
valid: runrestart, and reboot. This parameter must be used
in conjunction with the reset=parameter. Use actions= “” to take
no action upon failure.

/? Displays help at the command prompt.

Top of
page 

Syntax

sc [ServerNamegetkeyname [ServiceDisplayName] [BufferSize]

Top of page 

Remarks

  • Not all services allow changes to their failure options. Some run as
    part of a service set.

  • To run a batch file upon failure,
    specify cmd**.exe Drive:\FileName.bat to
    the 
    command= parameter, where Drive:\FileName.bat**is
    the fully qualified name of the batch file.

  • To run a VBS file upon failure, specify cscript
    drive**
    :\myscript.vbs to the command= parameter,
    where drive
    :\myscript.vbs** is the fully qualified name
    of the script file.

  • It is possible to specify three different actions to
    the actions= parameter, which will be used the first, second,
    and third time a service fails.

  • Without a space between a parameter and its value (that is, type=
    own
    , not type=own), the operation will fail.

Top of
page 

Remarks

  • Not all services allow changes to their failure options. Some run as
    part of a service set.

  • To run a batch file upon failure,
    specify cmd**.exe Drive:\FileName.bat to
    the 
    command= parameter, where Drive:\FileName.bat**is
    the fully qualified name of the batch file.

  • To run a VBS file upon failure, specify cscript
    drive**
    :\myscript.vbs to the command= parameter,
    where drive
    :\myscript.vbs** is the fully qualified name
    of the script file.

  • It is possible to specify three different actions to
    the actions= parameter, which will be used the first, second,
    and third time a service fails.

  • Without a space between a parameter and its value (that is, type=
    own
    , not type=own), the operation will fail.

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceDisplayName   Specifies the display name of the
service.

BufferSize   Specifies the size (in bytes) of the buffer.
The default is 1024 bytes.

/? Displays help at the command prompt.

Top of page 

Examples

The following examples show how you can use the sc failure command:

sc failure msftpsvc reset= 30 actions= restart/5000 
sc failure dfs reset= 60 command=
c:\windows\services\restart_dfs.exe actions= run/5000
 
sc failure dfs reset= 60 actions= reboot/30000 
sc failure dfs reset= 60 reboot= “The Distributed File System service
has failed. Because of this, the computer will reboot in 30 seconds.”
actions= reboot/30000
 
sc failure myservice reset= 3600 reboot= “MyService crashed —
rebooting machine” command= “
 %windir%\MyServiceRecovery.exe”
actions= restart/5000/run/10000/reboot/60000

sc getdisplayname

Gets the display name associated with a particular service.

Top of
page 

Examples

The following examples show how you can use the sc failure command:

sc failure msftpsvc reset= 30 actions= restart/5000 
sc failure dfs reset= 60 command=
c:\windows\services\restart_dfs.exe actions= run/5000
 
sc failure dfs reset= 60 actions= reboot/30000 
sc failure dfs reset= 60 reboot= “The Distributed File System service
has failed. Because of this, the computer will reboot in 30 seconds.”
actions= reboot/30000
 
sc failure myservice reset= 3600 reboot= “MyService crashed —
rebooting machine” command= “
 %windir%\MyServiceRecovery.exe”
actions= restart/5000/run/10000/reboot/60000

sc getdisplayname

Gets the display name associated with a particular service.

Top of
page 

Remarks

  • If the ServiceDisplayName contains spaces, use quotation marks
    around the text (that is, “*Service Display Name*”).

Top of page 

Syntax

sc [ServerNamegetdisplayname [ServiceName] [BufferSize]

Top of
page 

Syntax

sc [ServerNamegetdisplayname [ServiceName] [BufferSize]

Top of
page 

Examples

The following examples show how you can use the sc
getkeyname
 command:

sc getkeyname “remote procedure call (rpc)” 
sc getkeyname “internet connection sharing” 
sc getkeyname clipbook

sc interrogate

Sends an INTERROGATE control request to a service.

Top of page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

BufferSize   Specifies the size (in bytes) of the buffer.
The default is 1024 bytes.

/? Displays help at the command prompt.

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

BufferSize   Specifies the size (in bytes) of the buffer.
The default is 1024 bytes.

/? Displays help at the command prompt.

Top of
page 

Syntax

sc [ServerNameinterrogate [ServiceName]

Top of page 

Examples

The following examples show how you can use the sc
getdisplayname
 command:

sc getdisplayname clipsrv 
sc getdisplayname tapisrv 
sc getdisplayname sharedaccess

sc getkeyname

Gets the key name associated with a particular service, using the
display name as input.

Top of
page 

Examples

The following examples show how you can use the sc
getdisplayname
 command:

sc getdisplayname clipsrv 
sc getdisplayname tapisrv 
sc getdisplayname sharedaccess

sc getkeyname

Gets the key name associated with a particular service, using the
display name as input.

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

/? Displays help at the command prompt.

Top of page 

Syntax

sc [ServerNamegetkeyname [ServiceDisplayName] [BufferSize]

Top of
page 

Syntax

sc [ServerNamegetkeyname [ServiceDisplayName] [BufferSize]

Top of
page 

Remarks

  • Sending INTERROGATE to a service causes the service to update its
    status with the Service Control Manager.

Top of page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceDisplayName   Specifies the display name of the
service.

BufferSize   Specifies the size (in bytes) of the buffer.
The default is 1024 bytes.

/? Displays help at the command prompt.

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceDisplayName   Specifies the display name of the
service.

BufferSize   Specifies the size (in bytes) of the buffer.
The default is 1024 bytes.

/? Displays help at the command prompt.

Top of
page 

Examples

The following examples show how you can use the sc
interrogate
 command:

sc interrogate sharedaccess 
sc interrogate rpcss

sc lock

Locks the Service Control Manager’s database.

Top of page 

Remarks

  • If the ServiceDisplayName contains spaces, use quotation marks
    around the text (that is, “*Service Display Name*”).

Top of
page 

Remarks

  • If the ServiceDisplayName contains spaces, use quotation marks
    around the text (that is, “*Service Display Name*”).

Top of
page 

Syntax

sc [ServerNamelock

Top of page 

Examples

The following examples show how you can use the sc
getkeyname
 command:

sc getkeyname “remote procedure call (rpc)” 
sc getkeyname “internet connection sharing” 
sc getkeyname clipbook

sc interrogate

Sends an INTERROGATE control request to a service.

Top of
page 

Examples

The following examples show how you can use the sc
getkeyname
 command:

sc getkeyname “remote procedure call (rpc)” 
sc getkeyname “internet connection sharing” 
sc getkeyname clipbook

sc interrogate

Sends an INTERROGATE control request to a service.

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

/? Displays help at the command prompt.

Top of page 

Syntax

sc [ServerNameinterrogate [ServiceName]

Top of
page 

Syntax

sc [ServerNameinterrogate [ServiceName]

Top of
page 

Remarks

  • Locking the Service Control Manager’s database prevents any services
    from starting. Use this if you want to make sure that a service will
    not be started after it has been stopped. This will allow you to
    take some action (for example, deleting the service) without
    interference.

  • Using the lock operation locks the Service Control Manager’s
    database and then allows the database to be unlocked by typingu.
    You can also kill the process from which you locked the database.

Top of page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

/? Displays help at the command prompt.

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

/? Displays help at the command prompt.

Top of
page 

Examples

The following example shows how you can use the sc lock command:

sc lock

sc pause

Sends a PAUSE control request to a service.

Top of page 

Remarks

  • Sending INTERROGATE to a service causes the service to update its
    status with the Service Control Manager.

Top of
page 

Remarks

  • Sending INTERROGATE to a service causes the service to update its
    status with the Service Control Manager.

Top of
page 

Syntax

sc [ServerNamepause [ServiceName]

Top of page 

Examples

The following examples show how you can use the sc
interrogate
 command:

sc interrogate sharedaccess 
sc interrogate rpcss

sc lock

Locks the Service Control Manager’s database.

Top of
page 

Examples

The following examples show how you can use the sc
interrogate
 command:

sc interrogate sharedaccess 
sc interrogate rpcss

sc lock

Locks the Service Control Manager’s database.

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

/? Displays help at the command prompt.

Top of page 

Syntax

sc [ServerNamelock

Top of
page 

Syntax

sc [ServerNamelock

Top of
page 

Remarks

  • Use the pause operation to pause a service before shutting it
    down.

  • Not all services can be paused.

  • Not all services perform the same when paused. Some continue to
    service existing clients, but refuse to accept new clients. Others
    cease to service existing clients and also refuse to accept new
    ones.

Top of page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

/? Displays help at the command prompt.

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

/? Displays help at the command prompt.

Top of
page 

Examples

The following example shows how you can use the sc pause command:

sc pause tapisrv

sc qc

Queries the configuration information for a service.

Top of page 

Remarks

  • Locking the Service Control Manager’s database prevents any services
    from starting. Use this if you want to make sure that a service will
    not be started after it has been stopped. This will allow you to
    take some action (for example, deleting the service) without
    interference.

  • Using the lock operation locks the Service Control Manager’s
    database and then allows the database to be unlocked by typingu.
    You can also kill the process from which you locked the database.

Top of
page 

Remarks

  • Locking the Service Control Manager’s database prevents any services
    from starting. Use this if you want to make sure that a service will
    not be started after it has been stopped. This will allow you to
    take some action (for example, deleting the service) without
    interference.

  • Using the lock operation locks the Service Control Manager’s
    database and then allows the database to be unlocked by typingu.
    You can also kill the process from which you locked the database.

Top of
page 

Syntax

sc [ServerNameqc [ServiceName] [BufferSize]

Top of page 

Examples

The following example shows how you can use the sc lock command:

sc lock

sc pause

Sends a PAUSE control request to a service.

Top of
page 

Examples

The following example shows how you can use the sc lock command:

sc lock

sc pause

Sends a PAUSE control request to a service.

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

BufferSize   Specifies the size (in bytes) of the buffer.
The default is 1024 bytes.

/? Displays help at the command prompt.

Top of page 

Syntax

sc [ServerNamepause [ServiceName]

Top of
page 

Syntax

sc [ServerNamepause [ServiceName]

Top of
page 

Remarks

  • The qc operation displays the following information about a
    service: SERVICE_NAME (service’s registry subkey name), TYPE,
    ERROR_CONTROL, BINARY_PATH_NAME, LOAD_ORDER_GROUP, TAG,
    DISPLAY_NAME, DEPENDENCIES, and SERVICE_START_NAME.

  • Administrators can use SC to determine the binary name of any
    service and find out if it shares a process with other services by
    typing the following at the command line:

    sc qc ServiceName

    SC can help match up services in the Services node of Microsoft
    Management Console (MMC) with processes in System Monitor. If the
    binary name is Services.exe, then the service shares the Service
    Controller process.

    Services.exe starts all services. To conserve system resources,
    several Win32 services developed for Windows are written to share
    the Services.exe process. These services are not listed as separate
    processes in System Monitor or Task Manager. The same is true of
    Svchost.exe which is a service host process that many operating
    services share.

    There might not be a process for every Win32 service because
    third-party Win32 services can also be configured to share
    processes. SC can be used to get configuration information on these
    services. If a service does not share its process with other
    services, however, there will be a process for it in System Monitor
    when the service is running.

  • SC can be useful for developers of services because it provides more
    detailed and accurate information about services than Services.exe,
    which is included with Windows. Services.exe can determine whether a
    service is running, stopped, or paused. Although these tools are
    adequate for a debugged application that is running smoothly, the
    information they provide about a service being developed can be
    misleading. For example, a service that is starting is shown as
    started whether it is actually running or not.

    SC implements calls to all Windows service control application
    programming interface (API) functions. Set the parameters to these
    functions by specifying them at the command line.

    Using SC, you can query the service status and retrieve the values
    stored in the status structure fields. Services.exe cannot provide
    you with the complete status of a service, but SC shows the exact
    state of the service, as well as the last checkpoint number and wait
    hint. You can use the checkpoint as a debugging tool because it
    indicates how far the initialization progressed before the program
    stopped responding. SC also lets you specify the name of a remote
    computer so that you can call the service API functions or view the
    service status structures on a remote computer.

Top of page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

/? Displays help at the command prompt.

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

/? Displays help at the command prompt.

Top of
page 

Examples

The following examples show how you can use the sc qc command:

sc qc \\myserver newsrvice 
sc qc rpcss 248

sc qdescription

Displays the description string of a service.

Top of page 

Remarks

  • Use the pause operation to pause a service before shutting it
    down.

  • Not all services can be paused.

  • Not all services perform the same when paused. Some continue to
    service existing clients, but refuse to accept new clients. Others
    cease to service existing clients and also refuse to accept new
    ones.

Top of
page 

Remarks

  • Use the pause operation to pause a service before shutting it
    down.

  • Not all services can be paused.

  • Not all services perform the same when paused. Some continue to
    service existing clients, but refuse to accept new clients. Others
    cease to service existing clients and also refuse to accept new
    ones.

Top of
page 

Syntax

sc [ServerNameqdescription [ServiceName] [BufferSize]

Top of page 

Examples

The following example shows how you can use the sc pause command:

sc pause tapisrv

sc qc

Queries the configuration information for a service.

Top of
page 

Examples

The following example shows how you can use the sc pause command:

sc pause tapisrv

sc qc

Queries the configuration information for a service.

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

BufferSize   Specifies the size (in bytes) of the buffer.
The default is 1024 bytes.

/? Displays help at the command prompt.

Top of page 

Syntax

sc [ServerNameqc [ServiceName] [BufferSize]

Top of
page 

Syntax

sc [ServerNameqc [ServiceName] [BufferSize]

Top of
page 

Examples

The following examples show how you can use the sc
qdescription
 command:

sc qdescription rpcss 
sc qdescription rpcss 138

sc qfailure

Displays the actions that will be performed if the specified service
fails.

Top of page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

BufferSize   Specifies the size (in bytes) of the buffer.
The default is 1024 bytes.

/? Displays help at the command prompt.

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

BufferSize   Specifies the size (in bytes) of the buffer.
The default is 1024 bytes.

/? Displays help at the command prompt.

Top of
page 

Syntax

sc [ServerNameqfailure [ServiceName] [BufferSize]

Top of page 

Remarks

  • The qc operation displays the following information about a
    service: SERVICE_NAME (service’s registry subkey name), TYPE,
    ERROR_CONTROL, BINARY_PATH_NAME, LOAD_ORDER_GROUP, TAG,
    DISPLAY_NAME, DEPENDENCIES, and SERVICE_START_NAME.

  • Administrators can use SC to determine the binary name of any
    service and find out if it shares a process with other services by
    typing the following at the command line:

    sc qc ServiceName

    SC can help match up services in the Services node of Microsoft
    Management Console (MMC) with processes in System Monitor. If the
    binary name is Services.exe, then the service shares the Service
    Controller process.

    Services.exe starts all services. To conserve system resources,
    several Win32 services developed for Windows are written to share
    the Services.exe process. These services are not listed as separate
    processes in System Monitor or Task Manager. The same is true of
    Svchost.exe which is a service host process that many operating
    services share.

    There might not be a process for every Win32 service because
    third-party Win32 services can also be configured to share
    processes. SC can be used to get configuration information on these
    services. If a service does not share its process with other
    services, however, there will be a process for it in System Monitor
    when the service is running.

  • SC can be useful for developers of services because it provides more
    detailed and accurate information about services than Services.exe,
    which is included with Windows. Services.exe can determine whether a
    service is running, stopped, or paused. Although these tools are
    adequate for a debugged application that is running smoothly, the
    information they provide about a service being developed can be
    misleading. For example, a service that is starting is shown as
    started whether it is actually running or not.

    SC implements calls to all Windows service control application
    programming interface (API) functions. Set the parameters to these
    functions by specifying them at the command line.

    Using SC, you can query the service status and retrieve the values
    stored in the status structure fields. Services.exe cannot provide
    you with the complete status of a service, but SC shows the exact
    state of the service, as well as the last checkpoint number and wait
    hint. You can use the checkpoint as a debugging tool because it
    indicates how far the initialization progressed before the program
    stopped responding. SC also lets you specify the name of a remote
    computer so that you can call the service API functions or view the
    service status structures on a remote computer.

Top of
page 

Remarks

  • The qc operation displays the following information about a
    service: SERVICE_NAME (service’s registry subkey name), TYPE,
    ERROR_CONTROL, BINARY_PATH_NAME, LOAD_ORDER_GROUP, TAG,
    DISPLAY_NAME, DEPENDENCIES, and SERVICE_START_NAME.

  • Administrators can use SC to determine the binary name of any
    service and find out if it shares a process with other services by
    typing the following at the command line:

    sc qc ServiceName

    SC can help match up services in the Services node of Microsoft
    Management Console (MMC) with processes in System Monitor. If the
    binary name is Services.exe, then the service shares the Service
    Controller process.

    Services.exe starts all services. To conserve system resources,
    several Win32 services developed for Windows are written to share
    the Services.exe process. These services are not listed as separate
    processes in System Monitor or Task Manager. The same is true of
    Svchost.exe which is a service host process that many operating
    services share.

    There might not be a process for every Win32 service because
    third-party Win32 services can also be configured to share
    processes. SC can be used to get configuration information on these
    services. If a service does not share its process with other
    services, however, there will be a process for it in System Monitor
    when the service is running.

  • SC can be useful for developers of services because it provides more
    detailed and accurate information about services than Services.exe,
    which is included with Windows. Services.exe can determine whether a
    service is running, stopped, or paused. Although these tools are
    adequate for a debugged application that is running smoothly, the
    information they provide about a service being developed can be
    misleading. For example, a service that is starting is shown as
    started whether it is actually running or not.

    SC implements calls to all Windows service control application
    programming interface (API) functions. Set the parameters to these
    functions by specifying them at the command line.

    Using SC, you can query the service status and retrieve the values
    stored in the status structure fields. Services.exe cannot provide
    you with the complete status of a service, but SC shows the exact
    state of the service, as well as the last checkpoint number and wait
    hint. You can use the checkpoint as a debugging tool because it
    indicates how far the initialization progressed before the program
    stopped responding. SC also lets you specify the name of a remote
    computer so that you can call the service API functions or view the
    service status structures on a remote computer.

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname peration.

BufferSize   Specifies the size (in bytes) of the buffer.
The default is 1024 bytes.

/? Displays help at the command prompt.

Top of page 

Examples

The following examples show how you can use the sc qc command:

sc qc \\myserver newsrvice 
sc qc rpcss 248

sc qdescription

Displays the description string of a service.

Top of
page 

Examples

The following examples show how you can use the sc qc command:

sc qc \\myserver newsrvice 
sc qc rpcss 248

sc qdescription

Displays the description string of a service.

Top of
page 

Remarks

  • The qfailure operation displays the following information about
    a service: SERVICE_NAME (service’s registry subkey name),
    RESET_PERIOD, REBOOT_MESSAGE, COMMAND_LINE, and FAILURE_ACTIONS.

Top of page 

Syntax

sc [ServerNameqdescription [ServiceName] [BufferSize]

Top of
page 

Syntax

sc [ServerNameqdescription [ServiceName] [BufferSize]

Top of
page 

Examples

The following examples show how you can use the sc qfailure command:

sc qfailure rpcss 
sc qfailure rpcss 20

sc query

Obtains and displays information about the specified service, driver,
type of service, or type of driver.

Top of page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

BufferSize   Specifies the size (in bytes) of the buffer.
The default is 1024 bytes.

/? Displays help at the command prompt.

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

BufferSize   Specifies the size (in bytes) of the buffer.
The default is 1024 bytes.

/? Displays help at the command prompt.

Top of
page 

Syntax

sc [ServerNamequery [ServiceName] [type= {driver|service|all}] [type= {own|share|interact|kernel|filesys|rec|adapt}] [state={active|inactive|all}] [bufsize= BufferSize] [ri= ResumeIndex] [group= GroupName

Top of page 

Examples

The following examples show how you can use the sc
qdescription
 command:

sc qdescription rpcss 
sc qdescription rpcss 138

sc qfailure

Displays the actions that will be performed if the specified service
fails.

Top of
page 

Examples

The following examples show how you can use the sc
qdescription
 command:

sc qdescription rpcss 
sc qdescription rpcss 138

sc qfailure

Displays the actions that will be performed if the specified service
fails.

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation. This query parameter is not used in
conjunction with other query parameters (other than ServerName).

type= { driver | service | all }   Specifies
what to enumerate. The default type is service.

Value

Description

driver

Specifies that only drivers are enumerated.

service

Specifies that only services are enumerated.

all

Specifies that both drivers and services are enumerated.

type= { own | share | interact | kernel | filesys | rec | adapt }   Specifies
the type of services or type of drivers to enumerate.

Value

Description

own

The service runs in its own process. It does not share an executable file with other services. This is the default.

share

The service runs as a shared process. It shares an executable file with other services.

interact

The service can interact with the desktop, receiving input from users. Interactive services must be run under the LocalSystem account.

kernel

Driver.

filesys

File system driver.

state= { active | inactive | all }   Specifies
the started state of the service for which to enumerate. The default
state is active.

Value

Description

active

Specifies all active services.

inactive

Specifies all paused or stopped services.

all

Specifies all services.

bufsize=   BufferSize   Specifies the size (in
bytes) of the enumeration buffer. The default size is 1024 bytes.
Increase the size of the enumeration buffer when the display resulting
from a query exceeds 1024 bytes.

ri=   ResumeIndex   Specifies the index number at
which to begin or resume the enumeration. The default is 0. Use this
parameter in conjunction with the bufsize= parameter when more
information is returned by a query than the default buffer can display.

group=   GroupName   Specifies the service group to
enumerate. The default is all groups.

/? Displays help at the command prompt.

Top of page 

Syntax

sc [ServerNameqfailure [ServiceName] [BufferSize]

Top of
page 

Syntax

sc [ServerNameqfailure [ServiceName] [BufferSize]

Top of
page 

Remarks

  • Without a space between a parameter and its value (that is, type=
    own
    , not type=own), the operation will fail.

  • The query operation displays the following information about a
    service: SERVICE_NAME (service’s registry subkey name), TYPE, STATE
    (as well as states which are not available), WIN32_EXIT_B,
    SERVICE_EXIT_B, CHECKPOINT, and WAIT_HINT.

  • The type= parameter can be used twice in some cases. The first
    appearance of the type= parameter specifies whether to query
    services, drivers, or all. The second appearance of
    the type= parameter specifies a type from
    the create operation to further narrow a query’s scope.

  • When the display resulting from a query command exceeds the size
    of the enumeration buffer, a message similar to the following is
    displayed:

    Enum: more data, need 1822 bytes start resume at index 79

    To display the remaining query information, rerun query,
    setting bufsize= to be the number of bytes and ri= to the
    specified index. For example, the remaining output would be
    displayed by typing the following at the command line:

    sc query bufsize= 1822 ri= 79

Top of page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname peration.

BufferSize   Specifies the size (in bytes) of the buffer.
The default is 1024 bytes.

/? Displays help at the command prompt.

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname peration.

BufferSize   Specifies the size (in bytes) of the buffer.
The default is 1024 bytes.

/? Displays help at the command prompt.

Top of
page 

Examples

The following examples show how you can use the sc query command:

sc query 
sc query messenger 
sc query type= driver 
sc query type= service 
sc query state= all 
sc query bufsize= 50 
sc query ri= 14 
sc query type= service type= interact 
sc query type= driver group= ndis

sc queryex

Obtains and displays extended information about the specified service,
driver, type of service, or type of driver.

Top of page 

Remarks

  • The qfailure operation displays the following information about
    a service: SERVICE_NAME (service’s registry subkey name),
    RESET_PERIOD, REBOOT_MESSAGE, COMMAND_LINE, and FAILURE_ACTIONS.

Top of
page 

Remarks

  • The qfailure operation displays the following information about
    a service: SERVICE_NAME (service’s registry subkey name),
    RESET_PERIOD, REBOOT_MESSAGE, COMMAND_LINE, and FAILURE_ACTIONS.

Top of
page 

Syntax

sc [ServerNamequeryex [type= {driver|service|all}] [type= {own|share|interact|kernel|filesys|rec|adapt}] [state={active|inactive|all}] [bufsize= BufferSize] [ri= ResumeIndex] [group= GroupName]

Top of page 

Examples

The following examples show how you can use the sc qfailure command:

sc qfailure rpcss 
sc qfailure rpcss 20

sc query

Obtains and displays information about the specified service, driver,
type of service, or type of driver.

Top of
page 

Examples

The following examples show how you can use the sc qfailure command:

sc qfailure rpcss 
sc qfailure rpcss 20

sc query

Obtains and displays information about the specified service, driver,
type of service, or type of driver.

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation. This queryex parameter is not used in
conjunction with any other queryex parameters except ServerName.

type= { driver | service | all }   Specifies
what to enumerate. The default type is service.

Value

Description

driver

Specifies that only drivers are enumerated.

service

Specifies that only services are enumerated.

all

Specifies that both drivers and services are enumerated.

type= { own | share | interact | kernel | filesys | rec | adapt } : Specifies
the type of services or type of drivers to enumerate.

Value

Description

own

The service runs in its own process. It does not share an executable file with other services. This is the default.

share

The service runs as a shared process. It shares an executable file with other services.

interact

The service can interact with the desktop, receiving input from users. Interactive services must be run under the LocalSystem account.

kernel

Driver.

filesys

File system driver.

state= { active | inactive | all }   Specifies
the started state of the service for which to enumerate. The default
state is active.

Value

Description

active

Specifies all active services.

inactive

Specifies all paused or stopped services.

all

Specifies all services.

bufsize=   BufferSize   Specifies the size (in
bytes) of the enumeration buffer. The default size is 1024 bytes.

ri=   ResumeIndex   Specifies the index number at
which to begin or resume the enumeration. The default is 0.

group=   GroupName   Specifies the service group to
enumerate. The default is all groups.

/? Displays help at the command prompt.

Top of page 

Syntax

sc [ServerNamequery [ServiceName] [type= {driver|service|all}] [type= {own|share|interact|kernel|filesys|rec|adapt}] [state={active|inactive|all}] [bufsize= BufferSize] [ri= ResumeIndex] [group= GroupName

Top of
page 

Syntax

sc [ServerNamequery [ServiceName] [type= {driver|service|all}] [type= {own|share|interact|kernel|filesys|rec|adapt}] [state={active|inactive|all}] [bufsize= BufferSize] [ri= ResumeIndex] [group= GroupName

Top of
page 

Remarks

  • Without a space between a parameter and its value (that is, type=
    own
    , not type=own), the operation will fail.

  • The queryex operation displays the following information about a
    service: SERVICE_NAME (service’s registry subkey name), TYPE, STATE
    (as well as states that are not available), WIN32_EXIT_B,
    SERVICE_EXIT_B, CHECKPOINT, WAIT_HINT, PID, and FLAGS.

  • 澳门金沙国际 ,The type= parameter can be used twice in some cases. The first
    appearance of the type= parameter specifies whether to query
    services, drivers, or all. The second appearance of
    the type= parameter specifies a type from
    the create operation to further narrow a query’s scope.

  • When the display resulting from a queryex command exceeds the
    size of the enumeration buffer, a message similar to the following
    is displayed:

    Enum: more data, need 2130 bytes start resume at index 75

    To display the remaining queryex information, rerun queryex,
    setting bufsize= to be the number of bytes and ri= to the
    specified index. For example, the remaining output would be
    displayed by typing the following at the command line:

    sc queryex bufsize= 2130 ri= 75

Top of page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation. This query parameter is not used in
conjunction with other query parameters (other than ServerName).

type= { driver | service | all }   Specifies
what to enumerate. The default type is service.

Value

Description

driver

Specifies that only drivers are enumerated.

service

Specifies that only services are enumerated.

all

Specifies that both drivers and services are enumerated.

type= { own | share | interact | kernel | filesys | rec | adapt }   Specifies
the type of services or type of drivers to enumerate.

Value

Description

own

The service runs in its own process. It does not share an executable file with other services. This is the default.

share

The service runs as a shared process. It shares an executable file with other services.

interact

The service can interact with the desktop, receiving input from users. Interactive services must be run under the LocalSystem account.

kernel

Driver.

filesys

File system driver.

state= { active | inactive | all }   Specifies
the started state of the service for which to enumerate. The default
state is active.

Value

Description

active

Specifies all active services.

inactive

Specifies all paused or stopped services.

all

Specifies all services.

bufsize=   BufferSize   Specifies the size (in
bytes) of the enumeration buffer. The default size is 1024 bytes.
Increase the size of the enumeration buffer when the display resulting
from a query exceeds 1024 bytes.

ri=   ResumeIndex   Specifies the index number at
which to begin or resume the enumeration. The default is 0. Use this
parameter in conjunction with the bufsize= parameter when more
information is returned by a query than the default buffer can display.

group=   GroupName   Specifies the service group to
enumerate. The default is all groups.

/? Displays help at the command prompt.

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation. This query parameter is not used in
conjunction with other query parameters (other than ServerName).

type= { driver | service | all }   Specifies
what to enumerate. The default type is service.

Value

Description

driver

Specifies that only drivers are enumerated.

service

Specifies that only services are enumerated.

all

Specifies that both drivers and services are enumerated.

type= { own | share | interact | kernel | filesys | rec | adapt }   Specifies
the type of services or type of drivers to enumerate.

Value

Description

own

The service runs in its own process. It does not share an executable file with other services. This is the default.

share

The service runs as a shared process. It shares an executable file with other services.

interact

The service can interact with the desktop, receiving input from users. Interactive services must be run under the LocalSystem account.

kernel

Driver.

filesys

File system driver.

state= { active | inactive | all }   Specifies
the started state of the service for which to enumerate. The default
state is active.

Value

Description

active

Specifies all active services.

inactive

Specifies all paused or stopped services.

all

Specifies all services.

bufsize=   BufferSize   Specifies the size (in
bytes) of the enumeration buffer. The default size is 1024 bytes.
Increase the size of the enumeration buffer when the display resulting
from a query exceeds 1024 bytes.

ri=   ResumeIndex   Specifies the index number at
which to begin or resume the enumeration. The default is 0. Use this
parameter in conjunction with the bufsize= parameter when more
information is returned by a query than the default buffer can display.

group=   GroupName   Specifies the service group to
enumerate. The default is all groups.

/? Displays help at the command prompt.

Top of
page 

Examples

The following examples show how you can use the sc queryex command:

sc queryex messenger 
sc queryex group= “”

sc querylock

Queries and displays the lock status for the Service Control Manager’s
database.

Top of page 

Remarks

  • Without a space between a parameter and its value (that is, type=
    own
    , not type=own), the operation will fail.

  • The query operation displays the following information about a
    service: SERVICE_NAME (service’s registry subkey name), TYPE, STATE
    (as well as states which are not available), WIN32_EXIT_B,
    SERVICE_EXIT_B, CHECKPOINT, and WAIT_HINT.

  • The type= parameter can be used twice in some cases. The first
    appearance of the type= parameter specifies whether to query
    services, drivers, or all. The second appearance of
    the type= parameter specifies a type from
    the create operation to further narrow a query’s scope.

  • When the display resulting from a query command exceeds the size
    of the enumeration buffer, a message similar to the following is
    displayed:

    Enum: more data, need 1822 bytes start resume at index 79

    To display the remaining query information, rerun query,
    setting bufsize= to be the number of bytes and ri= to the
    specified index. For example, the remaining output would be
    displayed by typing the following at the command line:

    sc query bufsize= 1822 ri= 79

Top of
page 

Remarks

  • Without a space between a parameter and its value (that is, type=
    own
    , not type=own), the operation will fail.

  • The query operation displays the following information about a
    service: SERVICE_NAME (service’s registry subkey name), TYPE, STATE
    (as well as states which are not available), WIN32_EXIT_B,
    SERVICE_EXIT_B, CHECKPOINT, and WAIT_HINT.

  • The type= parameter can be used twice in some cases. The first
    appearance of the type= parameter specifies whether to query
    services, drivers, or all. The second appearance of
    the type= parameter specifies a type from
    the create operation to further narrow a query’s scope.

  • When the display resulting from a query command exceeds the size
    of the enumeration buffer, a message similar to the following is
    displayed:

    Enum: more data, need 1822 bytes start resume at index 79

    To display the remaining query information, rerun query,
    setting bufsize= to be the number of bytes and ri= to the
    specified index. For example, the remaining output would be
    displayed by typing the following at the command line:

    sc query bufsize= 1822 ri= 79

Top of
page 

Syntax

sc [ServerNamequerylock

Top of page 

Examples

The following examples show how you can use the sc query command:

sc query 
sc query messenger 
sc query type= driver 
sc query type= service 
sc query state= all 
sc query bufsize= 50 
sc query ri= 14 
sc query type= service type= interact 
sc query type= driver group= ndis

sc queryex

Obtains and displays extended information about the specified service,
driver, type of service, or type of driver.

Top of
page 

Examples

The following examples show how you can use the sc query command:

sc query 
sc query messenger 
sc query type= driver 
sc query type= service 
sc query state= all 
sc query bufsize= 50 
sc query ri= 14 
sc query type= service type= interact 
sc query type= driver group= ndis

sc queryex

Obtains and displays extended information about the specified service,
driver, type of service, or type of driver.

Top of
page 

Parameter

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

/? Displays help at the command prompt.

sc sdset

Sets a service’s security descriptor using Service Descriptor Definition
Language (SDDL).

Top of page 

Syntax

sc [ServerNamequeryex [type= {driver|service|all}] [type= {own|share|interact|kernel|filesys|rec|adapt}] [state={active|inactive|all}] [bufsize= BufferSize] [ri= ResumeIndex] [group= GroupName]

Top of
page 

Syntax

sc [ServerNamequeryex [type= {driver|service|all}] [type= {own|share|interact|kernel|filesys|rec|adapt}] [state={active|inactive|all}] [bufsize= BufferSize] [ri= ResumeIndex] [group= GroupName]

Top of
page 

Syntax

sc [ServerNamesdset ServiceName ServiceSecurityDescriptor

Top of page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation. This queryex parameter is not used in
conjunction with any other queryex parameters except ServerName.

type= { driver | service | all }   Specifies
what to enumerate. The default type is service.

Value

Description

driver

Specifies that only drivers are enumerated.

service

Specifies that only services are enumerated.

all

Specifies that both drivers and services are enumerated.

type= { own | share | interact | kernel | filesys | rec | adapt } : Specifies
the type of services or type of drivers to enumerate.

Value

Description

own

The service runs in its own process. It does not share an executable file with other services. This is the default.

share

The service runs as a shared process. It shares an executable file with other services.

interact

The service can interact with the desktop, receiving input from users. Interactive services must be run under the LocalSystem account.

kernel

Driver.

filesys

File system driver.

state= { active | inactive | all }   Specifies
the started state of the service for which to enumerate. The default
state is active.

Value

Description

active

Specifies all active services.

inactive

Specifies all paused or stopped services.

all

Specifies all services.

bufsize=   BufferSize   Specifies the size (in
bytes) of the enumeration buffer. The default size is 1024 bytes.

ri=   ResumeIndex   Specifies the index number at
which to begin or resume the enumeration. The default is 0.

group=   GroupName   Specifies the service group to
enumerate. The default is all groups.

/? Displays help at the command prompt.

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation. This queryex parameter is not used in
conjunction with any other queryex parameters except ServerName.

type= { driver | service | all }   Specifies
what to enumerate. The default type is service.

Value

Description

driver

Specifies that only drivers are enumerated.

service

Specifies that only services are enumerated.

all

Specifies that both drivers and services are enumerated.

type= { own | share | interact | kernel | filesys | rec | adapt } : Specifies
the type of services or type of drivers to enumerate.

Value

Description

own

The service runs in its own process. It does not share an executable file with other services. This is the default.

share

The service runs as a shared process. It shares an executable file with other services.

interact

The service can interact with the desktop, receiving input from users. Interactive services must be run under the LocalSystem account.

kernel

Driver.

filesys

File system driver.

state= { active | inactive | all }   Specifies
the started state of the service for which to enumerate. The default
state is active.

Value

Description

active

Specifies all active services.

inactive

Specifies all paused or stopped services.

all

Specifies all services.

bufsize=   BufferSize   Specifies the size (in
bytes) of the enumeration buffer. The default size is 1024 bytes.

ri=   ResumeIndex   Specifies the index number at
which to begin or resume the enumeration. The default is 0.

group=   GroupName   Specifies the service group to
enumerate. The default is all groups.

/? Displays help at the command prompt.

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

ServiceSecurityDescriptor   Specifies the service descriptor
in SDDL.

/? Displays help at the command prompt.

Top of page 

Remarks

  • Without a space between a parameter and its value (that is, type=
    own
    , not type=own), the operation will fail.

  • The queryex operation displays the following information about a
    service: SERVICE_NAME (service’s registry subkey name), TYPE, STATE
    (as well as states that are not available), WIN32_EXIT_B,
    SERVICE_EXIT_B, CHECKPOINT, WAIT_HINT, PID, and FLAGS.

  • The type= parameter can be used twice in some cases. The first
    appearance of the type= parameter specifies whether to query
    services, drivers, or all. The second appearance of
    the type= parameter specifies a type from
    the create operation to further narrow a query’s scope.

  • When the display resulting from a queryex command exceeds the
    size of the enumeration buffer, a message similar to the following
    is displayed:

    Enum: more data, need 2130 bytes start resume at index 75

    To display the remaining queryex information, rerun queryex,
    setting bufsize= to be the number of bytes and ri= to the
    specified index. For example, the remaining output would be
    displayed by typing the following at the command line:

    sc queryex bufsize= 2130 ri= 75

Top of
page 

Remarks

  • Without a space between a parameter and its value (that is, type=
    own
    , not type=own), the operation will fail.

  • The queryex operation displays the following information about a
    service: SERVICE_NAME (service’s registry subkey name), TYPE, STATE
    (as well as states that are not available), WIN32_EXIT_B,
    SERVICE_EXIT_B, CHECKPOINT, WAIT_HINT, PID, and FLAGS.

  • The type= parameter can be used twice in some cases. The first
    appearance of the type= parameter specifies whether to query
    services, drivers, or all. The second appearance of
    the type= parameter specifies a type from
    the create operation to further narrow a query’s scope.

  • When the display resulting from a queryex command exceeds the
    size of the enumeration buffer, a message similar to the following
    is displayed:

    Enum: more data, need 2130 bytes start resume at index 75

    To display the remaining queryex information, rerun queryex,
    setting bufsize= to be the number of bytes and ri= to the
    specified index. For example, the remaining output would be
    displayed by typing the following at the command line:

    sc queryex bufsize= 2130 ri= 75

Top of
page 

Remarks

  • For more information about SDDL, see “Security Descriptor Definition
    Language” at the MSDN Online Library .

sc sdshow

Displays a service’s security descriptor using SDDL.

Top of page 

Examples

The following examples show how you can use the sc queryex command:

sc queryex messenger 
sc queryex group= “”

sc querylock

Queries and displays the lock status for the Service Control Manager’s
database.

Top of
page 

Examples

The following examples show how you can use the sc queryex command:

sc queryex messenger 
sc queryex group= “”

sc querylock

Queries and displays the lock status for the Service Control Manager’s
database.

Top of
page 

Syntax

sc [ServerNamesdshow ServiceName

Top of page 

Syntax

sc [ServerNamequerylock

Top of
page 

Syntax

sc [ServerNamequerylock

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

/? Displays help at the command prompt.

Top of page 

Parameter

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

/? Displays help at the command prompt.

sc sdset

Sets a service’s security descriptor using Service Descriptor Definition
Language (SDDL).

Top of
page 

Parameter

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

/? Displays help at the command prompt.

sc sdset

Sets a service’s security descriptor using Service Descriptor Definition
Language (SDDL).

Top of
page 

Remarks

  • For more information about SDDL, see “Security Descriptor Definition
    Language” at the MSDN Online Library .

Top of page 

Syntax

sc [ServerNamesdset ServiceName ServiceSecurityDescriptor

Top of
page 

Syntax

sc [ServerNamesdset ServiceName ServiceSecurityDescriptor

Top of
page 

Examples

sc sdshow rpcss

sc start

Starts a service running.

Top of page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

ServiceSecurityDescriptor   Specifies the service descriptor
in SDDL.

/? Displays help at the command prompt.

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

ServiceSecurityDescriptor   Specifies the service descriptor
in SDDL.

/? Displays help at the command prompt.

Top of
page 

Syntax

sc [ServerNamestart ServiceName [ServiceArguments]

Top of page 

Remarks

  • For more information about SDDL, see “Security Descriptor Definition
    Language” at the MSDN Online
    Library .

sc sdshow

Displays a service’s security descriptor using SDDL.

Top of
page 

Remarks

  • For more information about SDDL, see “Security Descriptor Definition
    Language” at the MSDN Online
    Library .

sc sdshow

Displays a service’s security descriptor using SDDL.

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

ServiceArguments   Specifies service arguments to pass to
the service to be started.

/? Displays help at the command prompt.

Top of page 

Syntax

sc [ServerNamesdshow ServiceName

Top of
page 

Syntax

sc [ServerNamesdshow ServiceName

Top of
page 

Examples

The following example shows how you can use the sc start command:

sc start tapisrv

sc stop

Sends a STOP control request to a service.

Top of page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

/? Displays help at the command prompt.

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

/? Displays help at the command prompt.

Top of
page 

Syntax

sc [ServerNamestop ServiceName

Top of page 

Remarks

  • For more information about SDDL, see “Security Descriptor Definition
    Language” at the MSDN Online
    Library .

Top of
page 

Remarks

  • For more information about SDDL, see “Security Descriptor Definition
    Language” at the MSDN Online
    Library .

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

/? Displays help at the command prompt.

Top of page 

Examples

sc sdshow rpcss

sc start

Starts a service running.

Top of
page 

Examples

sc sdshow rpcss

sc start

Starts a service running.

Top of
page 

Remarks

  • Not all services can be stopped.

Top of page 

Syntax

sc [ServerNamestart ServiceName [ServiceArguments]

Top of
page 

Syntax

sc [ServerNamestart ServiceName [ServiceArguments]

Top of
page 

Examples

The following example shows how you can use the sc stop command:

sc stop tapisrv

Top of page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

ServiceArguments   Specifies service arguments to pass to
the service to be started.

/? Displays help at the command prompt.

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

ServiceArguments   Specifies service arguments to pass to
the service to be started.

/? Displays help at the command prompt.

Top of
page 

Remarks

Examples

The following example shows how you can use the sc start command:

sc start tapisrv

sc stop

Sends a STOP control request to a service.

Top of
page 

Examples

The following example shows how you can use the sc start command:

sc start tapisrv

sc stop

Sends a STOP control request to a service.

Top of
page 

Formatting legend

Format

Meaning

Italic

Information that the user must supply

Bold

Elements that the user must type exactly as shown

Ellipsis (…)

Parameter that can be repeated several times in a command line

Between brackets ([])

Optional items

Between braces ({}); choices separated by pipe (|). Example: {even|odd}

Set of choices from which the user must choose only one

Courier font

Code or program output

 

 

 

参考网站:
备注:网站内容是翻译得来,源网站在下边 SC…

Syntax

sc [ServerNamestop ServiceName

Top of
page 

Syntax

sc [ServerNamestop ServiceName

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

/? Displays help at the command prompt.

Top of
page 

Parameters

ServerName   Specifies the name of the remote server on
which the service is located. The name must use the UNC format
(“\\myserver”). To run SC.exe locally, ignore this parameter.

ServiceName   Specifies the service name returned by
the getkeyname operation.

/? Displays help at the command prompt.

Top of
page 

Remarks

  • Not all services can be stopped.

Top of
page 

Remarks

  • Not all services can be stopped.

Top of
page 

Examples

The following example shows how you can use the sc stop command:

sc stop tapisrv

Top of
page 

Examples

The following example shows how you can use the sc stop command:

sc stop tapisrv

Top of
page 

Remarks

Top of
page 

Remarks

Top of
page 

Formatting legend

Format

Meaning

Italic

Information that the user must supply

Bold

Elements that the user must type exactly as shown

Ellipsis (…)

Parameter that can be repeated several times in a command line

Between brackets ([])

Optional items

Between braces ({}); choices separated by pipe (|). Example: {even|odd}

Set of choices from which the user must choose only one

Courier font

Code or program output

 

 

 

Formatting legend

Format

Meaning

Italic

Information that the user must supply

Bold

Elements that the user must type exactly as shown

Ellipsis (…)

Parameter that can be repeated several times in a command line

Between brackets ([])

Optional items

Between braces ({}); choices separated by pipe (|). Example: {even|odd}

Set of choices from which the user must choose only one

Courier font

Code or program output

 

 

 

相关文章