Conditionally starting a service

Z

zipobibrok5X10e8

Hi All ,

Hope this is the right group.

I want to start a service only if another service has been started. How
do I do that using the net start command ? Sorry if the question is
repeated.

net start | find /i "Alerter">nul||net start "ASP.NET State Service"

I want the command to work such that , only if the Alerter service has
started , I want ASP.NET to start.

In short I want something like this to be done :

if(Service 1 has started)
Start Service 2.
else
Do not start Service 2.

How do I accomplish this?

Thank You.
 
J

Jerold Schulman

Hi All ,

Hope this is the right group.

I want to start a service only if another service has been started. How
do I do that using the net start command ? Sorry if the question is
repeated.

net start | find /i "Alerter">nul||net start "ASP.NET State Service"

I want the command to work such that , only if the Alerter service has
started , I want ASP.NET to start.

In short I want something like this to be done :

if(Service 1 has started)
Start Service 2.
else
Do not start Service 2.

How do I accomplish this?

Thank You.

Using the service display names for both the find and net start, not the service short name (key):

for /f "Tokens=*" %%a in ('net start^|Find /i "Alerter"') do (
net start "ASP.NET State Service"
)

Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
http://www.jsifaq.com
 
F

foxidrive

net start|find /i "Alerter">nul&&net start "ASP.NET State Service"

I think that's another option.
 
D

Dave Patrick

This article may also help.

http://support.microsoft.com/default.aspx?scid=kb;[LN];193888

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

:
| Hi All ,
|
| Hope this is the right group.
|
| I want to start a service only if another service has been started. How
| do I do that using the net start command ? Sorry if the question is
| repeated.
|
| net start | find /i "Alerter">nul||net start "ASP.NET State Service"
|
| I want the command to work such that , only if the Alerter service has
| started , I want ASP.NET to start.
|
| In short I want something like this to be done :
|
| if(Service 1 has started)
| Start Service 2.
| else
| Do not start Service 2.
|
| How do I accomplish this?
|
| Thank You.
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top