views:

2705

answers:

7

I occasionally find myself starting and stopping multiple windows services. The only tool I'm aware of for stopping and starting windows services is the "Services" program under "Administrative Tools" (%SystemRoot%\system32\services.msc /s). This program seems to only allow you to manipulate one service at a time, often pausing while it waits for the service to stop. There is a "Close" button available, but I'd prefer to just select all the services I want to stop or start, and perform a single command on all of them at one time.

Is there an easier way to start and stop multiple windows services for Windows XP?

A: 

Try msconfig (go to the "Run" dialog, type "msconfig"). Choose the "services" tab.

Colin
+2  A: 

What about the command line?

GeorgeM
+1  A: 

The net start and net stop commands are where you're going...

Jason Punyon
A: 

You could write a command/batch script that uses the command-line service controller, sc.exe.

Alternatively, you could check out the SysInternals psservice.exe command-line tool.

Drew Noakes
+7  A: 

Use the "net start" and "net stop" commands in your cmd.exe to start and stop a service:

net start "Service name with space"
net stop SerivceNameWithoutSpace

Be aware that you will need quotes if the service name has spaces.

Theo Lenndorff
+1  A: 

It possible to start/stop Windows services by using command-line tools such as net start/net stop and sc, but as far as I known none of them allows to operate on more than one service at once.

The easiest solution is to invoke the command-line tool multiple times by specifying different service names in a batch file.

Also, note that the reason why there is a delay between issuing a stop command to a Windows Service and the time when the process actually exits is due to the fact that the Windows Service Controller waits up to 30 seconds to allow services to shutdown properly.
If a service doesn't exit by that time, a message will inform you that "the service didn't respond in a timely fashion". More details can be found here.

Enrico Campidoglio
+3  A: 

You could use powershell.
Something like :

get-service -displayname SQL | stop-service

This stops all services with SQL in their display name.
http://www.microsoft.com/technet/scriptcenter/topics/msh/cmdlets/stop-service.mspx

notandy