Solved

Use NET start

Posted on 2010-08-19
1
552 Views
Last Modified: 2012-05-10
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
0
Comment
Question by:Deyhim
1 Comment
 
LVL 69

Accepted Solution

by:
Qlemo earned 500 total points
ID: 33472715
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

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of my most closely kept secrets is revealed in this discussion How to output text on the same line This question was recently posted in EE by Simon336697 (http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/Q_2459…
I have published numerous articles here at Experts Exchange that present programs/scripts written in a language called AutoHotkey. Each of those articles has a brief paragraph describing where to download the product and how to install it. I have al…

838 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question