Partager via


Sc

 

Applies To: Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7, Windows Server 2003 with SP2, Windows Server 2003 R2, Windows Server 2008 R2, Windows Server 2012, Windows Server 2003 with SP1, Windows 8

Communicates with the Service Controller and installed services. The SC.exe program provides capabilities similar to those provided in Services in the Control Panel.

For the syntax of any of the commands in the following table, click the command name.

Sc Commands

Sc command

Description

Sc boot

Indicates whether the last boot should be saved as the last-known good boot configuration.

Sc config

Modifies the value of a service's entries in the registry and in the Service Control Manager database.

Sc continue

Sends a CONTINUE control request to a paused service.

Sc control

Sends a control to a service.

Sc create

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

Sc delete

Deletes a service subkey from the registry.

Sc description

Sets the description string for a service.

Sc enumdepend

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

Sc failure

Specifies one or more actions to be taken if a particular service fails.

Sc failureflag

Specifies whether to trigger recovery actions when a service stops as the result of an error.

Sc getdisplayname

Gets the display name associated with a particular service.

Sc getkeyname

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

Sc interrogate

Sends an INTERROGATE control request to a service.

Sc lock

Locks the Service Control Manager's database.

Sc pause

Sends a PAUSE control request to a service.

Sc qc

Queries the configuration information for a service.

Sc qdescription

Displays a service's description string.

Sc qfailure

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

Sc query

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

Sc queryex

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

Sc querylock

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

Sc sdset

Sets a service's security descriptor, using Security Descriptor Definition Language (SDDL).

Sc sdshow

Displays a service's security descriptor, using SDDL.

Sc start

Starts a service.

Sc stop

Sends a STOP control request to a service.

Remarks

  • SC.exe retrieves and sets control information about services.

  • You can use SC.exe for testing and debugging service programs.

  • Service properties stored in the registry can be set to control how service applications are started at boot time and can be run as background processes.

  • You can use the SC.exe parameters to configure a specific service, retrieve the current status of a service, and stop and start a service.

  • You can create batch files that call various SC.exe commands to automate the startup or shutdown sequence of services.

Additional references

Command-Line Syntax Key