The Service Controller (sc) command in CMD is used to communicate with the Service Control Manager and services on a local or remote machine. It allows you to manage services by starting, stopping, querying, or configuring their properties.
Basic Commands for Managing Services
Querying a Service
To get the status of a service, use the following command:
sc qc "ServiceName"
- qc: Queries the configuration of the specified service.
Example
sc qc "wuauserv"
This command queries the configuration of the Windows Update service.
Starting a Service
To start a service that is not currently running:
sc start "ServiceName"
Example
sc start "wuauserv"
This starts the Windows Update service.
Stopping a Service
To stop a running service:
sc stop "ServiceName"
Example
sc stop "wuauserv"
This stops the Windows Update service.
Pausing and Resuming a Service
To pause a service that supports pausing:
sc pause "ServiceName"
To resume a paused service:
sc continue "ServiceName"
Example
sc pause "wuauserv"
sc continue "wuauserv"
This pauses and then resumes the Windows Update service.
Creating a Service
You can create a new service by using the sc create
command:
sc create "ServiceName" binPath= "path_to_executable"
- binPath: The path to the executable for the service.
Example
sc create "MyService" binPath= "C:\path\to\service.exe"
This creates a new service named MyService using the specified executable.
Deleting a Service
To delete an existing service:
sc delete "ServiceName"
Example
sc delete "MyService"
This deletes the MyService service.
Configuring a Service
You can configure the startup type of a service (e.g., manual, automatic, disabled) using the sc config
command:
sc config "ServiceName" start= type
- start=: The desired startup type (e.g., auto, demand, disabled).
Example
sc config "wuauserv" start= auto
This sets the Windows Update service to start automatically.
Common Service States
State | Description |
---|---|
running | The service is currently running. |
stopped | The service is not running. |
paused | The service is temporarily paused. |
Key Commands Comparison
Command | Description | Example |
---|---|---|
sc start | Starts a service | sc start "wuauserv" |
sc stop | Stops a running service | sc stop "wuauserv" |
sc pause | Pauses a service | sc pause "wuauserv" |
sc continue | Resumes a paused service | sc continue "wuauserv" |
sc create | Creates a new service | sc create "MyService" binPath= "C:\path\to\service.exe" |
sc delete | Deletes a service | sc delete "MyService" |
sc config | Configures service properties | sc config "wuauserv" start= auto |