sc - Manage Services

Maintained on

The sc command manages Windows services. A service is a program that keeps running in the background without anyone signing in, such as printing, Windows Update, or networking features.

With sc, you can check a service’s status, start and stop it, and change its startup type (automatic, manual, or disabled) entirely from the command line. You do not need to open the Services window (services.msc), which also makes sc a good fit for batch files.

Basic Syntax of the sc Command

sc <command> <service name> [options]

The first argument says what to do, followed by the name of the target service. The main commands are as follows.

CommandDescription
sc queryShow the status of a service
sc qcShow a service’s configuration (startup type, etc.)
sc startStart a service
sc stopStop a service
sc pausePause a service
sc continueResume a paused service
sc configChange a service’s configuration (startup type, etc.)
sc createRegister a new service
sc deleteDelete a service registration
In PowerShell, type sc.exe

In Windows PowerShell 5.1, sc is an alias for the Set-Content cmdlet. Typing sc query Spooler there does not manage services, so include the extension, as in sc.exe query Spooler. The commands in this article assume you are running them in Command Prompt.

Service Name vs. Display Name

Every service has a display name shown in services.msc (for example, Print Spooler) and a separate service name that you use in commands (for example, Spooler). sc takes the service name.

The output of sc query shows the service name (SERVICE_NAME) next to the display name (DISPLAY_NAME), so you can match them up.

Check the Status of a Service

Run sc query with the service name.

sc query Spooler
- □ ×
Command Prompt Icon
Command Prompt
Microsoft Windows [Version xx.x.xxxxx.xxx]
(c) 2026 Ribbit App Development All rights reserved.
 
C:\users\user>sc query Spooler
SERVICE_NAME: Spooler
TYPE : 110 WIN32_OWN_PROCESS (interactive)
STATE : 4 RUNNING
(STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
C:\users\user>

STATE is the current status. The main values are as follows.

STATE valueMeaning
RUNNINGRunning
STOPPEDStopped
START_PENDINGStarting up
STOP_PENDINGShutting down
PAUSEDPaused

Running sc query without a service name lists the running services. To include stopped services as well, specify state= all.

sc query type= service state= all
A space is required after = in options

sc options need a space right after the =, as in type= service. Writing type=service causes an error. Do not put a space before the =.

When the list is long, combine it with more or find to make it easier to read.

sc query type= service state= all | find "SERVICE_NAME"

Check a Service’s Configuration

sc qc (query config) shows the startup type and the path to the executable.

sc qc Spooler

START_TYPE shows the startup type, and BINARY_PATH_NAME shows the service’s executable.

Start and Stop a Service

Use sc start to start a service and sc stop to stop it.

sc start Spooler
sc stop Spooler
Administrator rights are required

Starting, stopping, and reconfiguring a service usually requires administrator rights. Running these in a normal Command Prompt gives “Access is denied” (error 5). See the related article for how to run as administrator. Checking status (sc query) works without administrator rights.

sc stop only sends a stop request and does not wait for the service to finish stopping. Right after running it you may see STOP_PENDING, so wait a moment and then use sc query to confirm it has reached STOPPED.

Restart a Service

sc has no restart command, so stop the service and start it again. Insert timeout to give the service time to stop.

restart-spooler.cmd
@echo off

sc stop Spooler
timeout /t 3 /nobreak >nul
sc start Spooler

Some services take longer than 3 seconds to stop. When you need to be sure, use the “Wait for a State” technique described below.

How It Differs from net start and net stop

net start <service name> and net stop <service name> can also start and stop services.

net stop Spooler
net start Spooler

net stop waits until the service has stopped before returning. It also stops any services that depend on it, after asking for confirmation. If you simply want to stop and start a service, net is more convenient. If you also need to check status or change configuration, sc is the better choice.

Change the Startup Type

The start= option of sc config changes what happens when Windows starts.

sc config Spooler start= demand
ValueStartup type
autoAutomatic
delayed-autoAutomatic (delayed start)
demandManual
disabledDisabled
Do not disable important services

Disabling a service makes the features that depend on it unavailable from the next startup onward. Do not change the configuration of a service you do not understand. Note the current settings with sc qc before changing anything so you can restore them.

Errors and How to Fix Them

When sc fails, it prints a message with an error number, such as [SC] OpenService FAILED 1060:.

ErrorCommon cause and fix
5Access denied. Run as administrator
1056The service is already running. Check the state with sc query
1060The service does not exist. Check that you used the service name, not the display name
1058The service cannot be started because it is disabled. Change the startup type with sc config
1062The service has not been started (you tried to stop one that is already stopped)

You can look up the meaning of an error number with net helpmsg, as in net helpmsg 1060.

Check the State in a Batch File

Searching the output of sc query with find tells you whether a service is running.

check-service.cmd
@echo off

sc query Spooler | find "RUNNING" >nul
if errorlevel 1 (
  echo Print Spooler is stopped.
) else (
  echo Print Spooler is running.
)

find returns exit code 0 when it finds a matching line and 1 when it does not, so if errorlevel 1 handles the “not found” case. The STATE values are in English regardless of the display language, so the same code works on any Windows language.

Wait for a State

To wait for a start or stop to finish, check repeatedly until the state reaches the value you want.

wait-stopped.cmd
@echo off

sc stop Spooler >nul

:wait
sc query Spooler | find "STOPPED" >nul
if errorlevel 1 (
  timeout /t 1 /nobreak >nul
  goto wait
)

echo Stopped.
Beware of infinite loops

If the service cannot stop, this example waits forever. For real use, it is safer to set a maximum number of attempts with a counter variable.

Register and Delete a Service

sc create registers your own program as a service. Give the path to the executable in binPath=.

sc create MyService binPath= "C:\tools\myservice.exe" start= demand

When you no longer need it, remove the registration with sc delete.

sc delete MyService
Deletion cannot be undone

sc delete removes the service registration without asking for confirmation. Deleting a service that ships with Windows can leave the system unable to work correctly. Use it only on services you registered yourself.

Note that an ordinary program or batch file does not work as a service as is. To run as a service, a program must be able to respond to requests from the Service Control Manager.

Summary

What you want to doCommand
Check a service’s statussc query <service name>
List all servicessc query type= service state= all
Check startup type and settingssc qc <service name>
Start a servicesc start <service name>
Stop a servicesc stop <service name>
Change the startup typesc config <service name> start= demand
Test whether a service is runningsc query <service name> | find "RUNNING"
Register or delete a servicesc create / sc delete

Practice Questions

Practice Problem

You run sc query Spooler in PowerShell, but no service information appears. What is the correct fix?

Choose one answer.

  1. Run it again as administrator
  2. Type the extension too, as in sc.exe query Spooler
  3. Replace the service name with the display name

Practice Problem

Which command changes a service’s startup type to Manual?

Choose one answer.

  1. sc config Spooler start=demand
  2. sc config Spooler start= demand
  3. sc start Spooler manual
#Command Prompt #Batch Files #Command Line #Commands #Services #Administrator Rights