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…]
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. |
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?'