Sc.exe: Service Controller Tool Topics | Next

SC Syntax


One Stepsc [\\ServerName] Command ServiceName [OptionName=OptionValue...]

Where:

\\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).
Description Changes the description of a service.
EnumDepend Enumerates service dependencies.
Failure Changes the actions taken by a service upon failure.
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.
To find out the name of the binary for any service and whether it shares a process with other services, run sc qc ServiceName.
Qdescription Queries the description of a service.
Qfailure Queries the actions taken by a service upon failure.
Query Queries the status for a service, or enumerates the status for types of services.
QueryEx Queries the status and extended information for a service, or enumerates the status and extended information for types of services.
SdShow Displays a service's security descriptor using SDDL.
SdSet Sets a service's security descriptor using SDDL.
Start Starts a service.
Stop Sends a STOP request to a service.

The following commands don't require a service name. Their syntax is:
sc [ServerName] Command [OptionName=OptionValue...]

Command Description
Boot Values are {ok | bad} Indicates whether the last restart should be saved as the last-known-good restart configuration
Lock Locks the Service Database
QueryLock Queries the LockStatus for the SCManager Database
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. You can get the ServiceName from the display name by running:

One Stepsc GetKeyName DisplayName

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, run:

One Stepsc Command

where Command is a valid command name as listed above.
OptionValue
Specifies the value for the parameter named by OptionName. For a list of available values, run:

One Stepsc Command

where Command is a valid command name as listed above.

Help Information at the Command Prompt

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

One Stepsc Command

where Command is a valid command name as listed above.

The exceptions are the Query and QuerytEx commands, which cause SC to list the status of all running services. For help on the Query and QueryEx commands, run the command sc, and at the prompt "Would you like to see help for the QUERY and QUERYEX commands?" type y.