New
#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?
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?
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
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:
To get a brief information about the service. Weather or not it's running will be displayed there.Code:SC QUERY <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 STOP <service name>
Just for completeness, this will, as the name suggest, start a service again.Code:SC START <service name>
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.
Thank you for the responses. Alejandros85, thanks, I did not know about the query part of SC.