Conditionally starting a service

  • Thread starter Thread starter zipobibrok5X10e8
  • Start date Start date
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.
 
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
 
net start|find /i "Alerter">nul&&net start "ASP.NET State Service"

I think that's another option.
 
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.
|
 
Back
Top