Service Control Utility

Windows NT Only

The Service Control utility (SC.EXE) is useful for testing and debugging your service program. SC implements calls to all of the Windows NT service control functions. You can specify any function parameters through the command line. You can create batch files that call SC with various command lines to see how your service behaves with repeated starting and stopping.

SC also displays complete status information, including state, checkpoint number, and wait hint.

The following is the command-line syntax for SC:

sc [ServerName] Command ServiceName [OptionName= OptionValue…]
 
ServerName
Specifies the name of the server if you are running the commands on a remote computer. The name must start with two backslash characters. If you are running the commands on the local computer, do not supply this parameter.
Command
Specifies one of the following SC commands:
Command Description
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 Gets the display name for a service.
GetKeyName Gets the name of the registry key 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. This is different from the display name that you see in the Service control panel application.
OptionName
The name of an optional command parameter. You can supply zero or more optional pairs of parameter names and values. For a list of available names, use the command sc command, where command is a valid command name, as listed for Command.
OptionValue
Specifies the value for the parameter named by OptionName. For a list of available values, use the command sc command, where command is a valid command name, as listed for Command.

To display help information for a command, use the following command-line syntax:

sc [Command]

where Command has the values listed previously. The exception is the Query command, which causes SC to list the status of all running services. For help on the Query command, use the command sc and type y at the prompt, "Would you like to see help for the QUERY command?'