Control services through command line

Windows XP, Vista and 7 all come with a command line tool sc to control services through command line. This makes it very easy to start, pause, query and stop services. Although this command line sc can do much more but we will cover only a few aspects of this command line.

Because this is a command line tool, you need to start the command prompt window. You can do this by pressing the key combination Windows Key + R to start the Run dialog. In the Run dialog, type cmd and press Enter. The command line tool sc has the following basic options.

sc start [servicename] : This is used to start a service named [servicename]. For example, if you want to start a service named Apache 2.2, then give the command sc start “Apache 2.2”. If the service name contains a space then, enclose the service name within double quotes.

sc stop [servicename] : This is used to stop a running service named [servicename]. For example, if you want to stop a service named Apache 2.2, then then give the command sc stop “Apache 2.2”.

sc pause [servicename] : This is used to pause a running service named [servicename]. For example, if you want to pause a service named Apache 2.2, then then give the command sc pause “Apache 2.2”. If later you want to un-pause this service, then use the continue command.

sc continue [servicename] : This is used to continue a paused service named [servicename]. For example, if you want to continue a service named Apache 2.2, then then give the command sc continue “Apache 2.2”.

sc query[servicename] : This is used to query the status of a service named [servicename]. For example, if you want to query the status of a service named Apache 2.2, then then give the command sc query “Apache 2.2”.

The above commands are the basic commands that an admin can find useful For more commands see the Windows Help on the command line tool sc.