Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: If Then Start Stop Service from Command Line

18 May 2015   #1
brubakes

Windows 8.1 Professional 64bit
 
 
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 System SpecsSystem Spec
.
18 May 2015   #2
torchwood

W7 home premium 32bit/W7HP 64bit/w10 tp insider ring
 
 

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
If Then Start Stop Service from Command Line-services.png  
My System SpecsSystem Spec
18 May 2015   #3
Alejandro85

Windows 7 Ultimate x64
 
 

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 System SpecsSystem Spec
.

19 May 2015   #4
brubakes

Windows 8.1 Professional 64bit
 
 

Thank you for the responses. Alejandros85, thanks, I did not know about the query part of SC.
My System SpecsSystem Spec
Reply

 If Then Start Stop Service from Command Line




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Executing command line command anywhere ?
I want to create a setup whereas a command line command can be run from any directory/folder, without having to be in the directory/folder whereas the command line command resides ?
General Discussion
Command Line - Help
Hi Guy's and Girls, Just first off I've never been too good with CMD and only an Apprentice in my company I work for. Now something I've wanted to do for awhile was to make the following but I don't necassirealy I know how to do this in one batch file: I would need a Batch file that is...
General Discussion
The dependency service or group failed to start- Command Prompt
Hi everyone! :D I'm having a pretty big problem on my laptop- I can't connect to the internet and when I try to connect in the network and sharing centre it simply says 'The dependency service or group failed to start' and I am unable to connect to the internet (Using wi-fi). There's a lot...
General Discussion
net start command line issue - 64bit issue?
I am trying (in vain) to issue a net start command "net start - "C:\Program Files (x86)\uTorrent\utorrent.exe", on the command line. The error message is "the filename, directory name or volume label syntax is incorrect". I believe the 3 details are correct, as i am looking at the utorrent.exe file...
General Discussion
Clickable service start/stop cmd or bat file. Possible?
Not sure if I labelled this post right, or if I am even posting this in the right category/forum. If admins could direct this if need be, that would be cool. What I would like to do is have some kind of .cmd or .bat file that will turn on or restart my PS3 Media Server service, just by...
Performance & Maintenance
Stop Command Line Window Message From Closing
I have a problem running a task with Task Scheduler. The task doesn't run. I have to debug it. When I try to make it run from the app a message appears on a command line message, but it appears and disappears so quickly that I can't read it. To fix the problem I need to read it to know what is...
General Discussion


Our Sites

Site Links

About Us

Find 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 13:28.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App