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.

  • Vampire

    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.

  • Alan

    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.

  • suneel kumar

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

  • Nin

    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.

    • Nin

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

  • vikas sharma

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

    -Vikas

  • Kelly

    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.

    • Amit

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

  • Anonymous

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

    • Srini

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

  • Wasti777

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