Site navigation

Related links


Managing Windows Services with the Service Controller Command
The Service Controller utility SC is a powerful command-line utility for managing Windows services. Its various capabilities and functions are discussed here.
Many processes and functions of the Windows operating system and other software are classified under the general rubric of “services”. Managing services with the graphical facility called the Services Console is discussed at a sister site. In addition to a GUI method of managing services, Windows XP, Vista, and 7 also have a powerful command-line utility.This utility, the Service Controller, is opened by entering "sc' into the command prompt and contains a large assembly of subcommands that we will survey.

The command-line method of managing services has the advantage of being available for scripts. It also allows for quickly stopping and starting services for troubleshooting purposes. Systems administrators use it for managing services on networks and for very detailed configuration. For the average PC user, it provides a quick and easy way to turn services on and off to see how system performance is affected.

The SC subcommands

The "sc" command comes with numerous subcommands. A list can be seen by entering "sc /?" into a command prompt. There is also a list in the Windows Help and Support Center. Altogether, 24 subcommands are listed. Each subcommand in turn may have a subset of different commands. The table below shows a selection of the subcommands and their functions that are of most relevance to a typical PC owner.

Command Function
sc config Configures service startup and login accounts
sc continue Resumes a paused service
sc enumdepend

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

sc failure Specifies what action to take upon failure of the service
sc pause Pauses a service
sc qc Displays the configuration of a particular service
sc query Displays information about the specified service, driver, type of service, or type of driver
sc start Starts a service running
sc stop Sends a STOP request to a service (not all will respond)

Examples of some useful ways to apply SC

The suite of commands that are available are very powerful and allow for much configuring of services. Although not all functions will be of interest to the average PC use, some are applicable to everyday experience. You can learn if a service is runninng, stop, start. or pause it, and determine if it will run when the system is started up. Here are examples of some commands that I think might be of interest.

sc config
This command has a number of functions but one is to determine the status of a service at system startup. A service can be set to run automatically, manually or not at all. The commands aresc config ServiceName start= flagHere ServiceName is the name of the service and flag has one of the values auto, demand. or disabled . For example, to set a service to run manually the command is sc config ServiceName start= demandNote that there must be a space after the equals sign. The correct value for the parameter ServiceName may not always be obvious and the next command can be used to find it for all services.
sc query
Information about services and drivers can be obtained with this command. Used alone it returns a list of running services with various information about the service. Lists can be inconvenient to read on a screen and they can be redirected to a text file. To create a text list of running services use the commandsc query > serviceslist.txt The path for the text file serviceslist.txt can be anywhere that is convenient. To create a list of all services, usesc query type= service state= all > allserviceslist.txt To create a list of active drivers, use sc query type= driver Or for a list of everything, use sc query state= all
sc start
To start up a service that is not running, usesc start ServiceName
sc stop
To stop a running service, use sc stop ServiceName However, some services cannot or should not be stopped.

Back to top

privacy policy