title: How to check if a service is running via batch file and start it, if it is not running?
body: <p>I want to write a batch file that performs the following operations: </p>
  
  <ul>
  <li>Check if a service is running  
  
  <ul>
  <li>If is it running, quit the batch  </li>
  <li>If it is not running, start the service  </li>
  </ul></li>
  </ul>
  
  <p>The code samples I googled so far turned out not to be working, so I decided not to post them. </p>
  
  <p>Starting a service is done by:</p>
  
  <pre><code>net start "SERVICENAME"
  </code></pre>
  
  <ol>
  <li>How can I check if a service is running, and how to make an if statement in a batchfile?  </li>
  <li>I'm a bit confused. What is the argument I have to pass onto the net start? The service name or its display name?</li>
  </ol>