General
cancel
Showing results for 
Search instead for 
Did you mean: 

Starting windows services through batch file

deserteagle
Occasional Visitor

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
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.