Use NET start

How to use net start command to work only if service is not running ?

when service already run; it will give an error message (already started)  how to hide this error ?

i want to have batch file.


Thanks
LVL 1
DeyhimAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
QlemoConnect With a Mentor DeveloperCommented:
The "stupid" approach, which is neverless the fastest and easist, is to issue the start command and suppress any error output:

net start MyService 2> nul > nul

If it is started already, nothing happens. No output shown and no error reported.
0
All Courses

From novice to tech pro — start learning today.