If Then Start Stop Service from Command Line


  1. Posts : 14
    Windows 8.1 Professional 64bit
       #1

    If Then Start Stop Service from Command Line


    Is there a away from the windows 7 command line I can check if a specific service is running and if it is stop it? If not specifically stop it is it possible to just check if its there?
      My Computer


  2. Posts : 7,107
    W7 home premium 32bit/W7HP 64bit/w10 tp insider ring
       #2

    Dont know of a command line script.

    i know that running services can be checked in the Task Manager (ctrl+alt+delete).

    You can also view and stop them from
    Control Panel>Admin tools>Services>rightclick properties.



    Roy
    Attached Thumbnails Attached Thumbnails If Then Start Stop Service from Command Line-services.png  
      My Computer


  3. Posts : 2,468
    Windows 7 Ultimate x64
       #3

    You can use the SC command for this purpose to manage services. It supports a wide range of operations on system services, but particularly useful for you question are sc query and sc stop. Use them like this:

    Code:
    SC QUERY <service name>
    To get a brief information about the service. Weather or not it's running will be displayed there.

    Code:
    SC STOP <service name>
    This will stop the service, if possible. If it's wasn't running it will simply show an error message, but it doesn't does anything else, so issuing this one right away without querying will do no harm at all.

    Code:
    SC START <service name>
    Just for completeness, this will, as the name suggest, start a service again.

    Note that for starting and stopping services you need to have administrative privileges. Querying state can be done by plain users too. Also, the <service name> you need to enter is each service internal name, NOT the display name shown in control panel. Look at the screenshot by torchwood, where the properties dialog shows both.
      My Computer


  4. Posts : 14
    Windows 8.1 Professional 64bit
    Thread Starter
       #4

    Thank you for the responses. Alejandros85, thanks, I did not know about the query part of SC.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 09:58.
Find Us