Windows: Service Managing Through Command Line

   Posted April 22, 2005 by David Kirk in Windows networking

How can I start, stop, or pause Windows Services from the command line? This Tech-Recipes tutorial describes how to perform these functions in all versions of Windows including XP and Windows 7.

First, we will need to open a command prompt terminal.

Go to the Start menu, and open a Command Prompt. With early versions of Windows, go to RUN, type CMD, and click on Enter. With later versions, just search for Command Prompt in the Start menu.

Command Examples

Here are the common methods of controlling the services through a command line. You can run these solo, scripted, or placed in batch files. The typical pattern is “net command servicename” where “command” is the actual command and “servicename” is the actual service you are manipulating.

Here are common examples, using the Telnet service as an example.

Net Start servicename to Start a Service
net start telnet

Net Stop servicename to Stop a Service
net stop telnet

Net Pause servicename to Pause a Service
net pause telnet

Net Continue servicename to Continue a Service
net continue telnet

In later versions of Windows, people frequently encounter the following error:

System error 5 has occurred.
Access is denied.

This error typically occurs when the user does not have administrative access. Try the command again after completing the following steps: right-click on Command Prompt, select Run as administrator, and confirm when the UAC prompt appears.

 

About David Kirk

David Kirk is one of the original founders of tech-recipes and is currently serving as editor-in-chief. Not only has he been crafting tutorials for over ten years, but in his other life he also enjoys taking care of critically ill patients as an ICU physician.
View more articles by David Kirk

The Conversation

Follow the reactions below and share your own thoughts.