Operating System - Microsoft
1748169 Members
4122 Online
108758 Solutions
New Discussion юеВ

Re: Starting windows services through batch file

 
deserteagle
New Member

Starting windows services through batch file

I have a requirement where I need to stop and start services for a particular application on a windows server through a batch file. Can anyone share some sample code for this?
5 REPLIES 5
Steven Schweda
Honored Contributor

Re: Starting windows services through batch file

Someone in one of the Microsoft forums might
be more likely than a typical reader of this
HP-UX forum.

"windows" is not a very complete description
of the OS involved.

It's just possible that "a particular
application" might differ in this respect
from some other "particular application".
Torsten.
Acclaimed Contributor

Re: Starting windows services through batch file

It's not a detailed question and it is asked in the wrong forum, but however, with this line you can stop the FTP server. It will be similar for other services:

c:\ net stop "ftp publishing"

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
WFHC-WI
Honored Contributor

Re: Starting windows services through batch file

hi deserteagle,

For local services some simple commands are:

net stop
net start

for remote servers you can use:

sc stop
sc start

or even

sc pause
sc continue

good luck and please assign points if these responses have helped!

Phil.Howell
Honored Contributor

Re: Starting windows services through batch file

You can also stop/start local services using the SC command
Srikanth Gadwal
Occasional Advisor

Re: Starting windows services through batch file

Hello DE,

Here is some information.

Services can be easily changed/accessed by creating batch files.

The important commands are the following:

NET START ├в starts the service
NET STOP ├в ends/stops the service

Before starting this we need to make sure which service we want to start or stop.

Go to Start├в >Run type services.msc click ok

Once we get the services windows we can see each service name.

Stop Window Services using Batch file

The following one is just example

First we need to open a notepad enter the following commands and save as stopservice.bat

NET STOP ├в Error Reporting Service├в
NET STOP ├в Messenger├в

The above commands stop the following services:

├в Error Reporting Service├в
├в Messenger├в

The same way we need to start the services using the following procedure we need to open a notepad enter the following commands and save as startservice.bat

NET START ├в Error Reporting Service├в
NET START ├в Messenger├в

These commands start the following services:

├в Error Reporting Service├в
├в Messenger├в

Hope, this would be of some help.

With regards and best wishes,
Kanth.