Solved

Use NET start

Posted on 2010-08-19
1
546 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 68

Accepted Solution

by:
Qlemo earned 500 total points
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

743 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now