Windows: Service Managing Through Command Line

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.

13 Responses to “Windows: Service Managing Through Command Line”

  1. October 07, 2008 at 7:17 am, Vampire said:

    Thanks for the post.
    I have few questions, and eagerly urge you all for response .
    1.But how to RESTART the Services ,because its not possible to learn about the service whether its in STOP mode or not using NET START /NET STOP.
    2. Whenever I issue NET STOP ,it prompts for yes/no for all the services. How can I say yes to all the dependent services..as i will not have provision if i execute a batch file in scheduled tasks.

    Thanks in Advance.
    Vampire.

    Reply

  2. October 17, 2008 at 2:27 am, Alan said:

    net stop servicename /y will suppress prompts. You can also check the return code of the net stop and net start commands. If the command fails, because it is already started or stopped, you get a return code.

    Reply

  3. May 26, 2009 at 9:18 am, suneel kumar said:

    Hi,
    How to check the status of the complete services available and also command for an individual service.

    Reply

  4. July 01, 2009 at 12:39 pm, Nin said:

    But how to figure out the “Service Name”. The Service properties says Service name: My Service Name Server (a 4 word name). I’ve tried NET START My Service Name Server and NET START “My Service Name Server”, but it keeps telling me that the name is invalid.; I then tried the executable name NET START MySvc and NET START MySvc.exe These also failed.

    Reply

    • July 01, 2009 at 12:46 pm, Nin said:

      My fault. Typo. This DID work: NET START “My Server Name Server”

      Reply

  5. July 07, 2009 at 7:07 am, vikas sharma said:

    I wanted to disable Windows update utility from command line. can you please help me on this?

    -Vikas

    Reply

  6. November 06, 2009 at 7:12 pm, Kelly said:

    How can I change a service properties through either command line or through scripting (java or sql )?
    I basically wants to change the services –> properties –> Log On as (from Local system account to “This Account”).

    Thanks for the help.

    Reply

    • October 16, 2010 at 2:34 pm, Amit said:

      I would like to know if we can set “Start up Type” for a service from command line..
      Thanks

      Reply

  7. March 24, 2010 at 2:39 pm, Anonymous said:

    How can the same be done in Windows 07 in cmd prompt?

    Reply

    • July 14, 2010 at 4:38 am, Srini said:

      this has not changed in windows 7, it’s same as xp..check the link above posted by MarcC.

      Reply

  8. July 26, 2011 at 9:16 am, Wasti777 said:

    How will i start/stop the service on remote computer from command line?

    Reply

Leave a Reply