title: Batch - check If program is running , if not , run it
body: <pre><code>@echo off
  tasklist /FI "IMAGENAME eq mc_com.exe" 2&gt;NUL | find /I /N "mc_com.exe" &gt;NUL
  if "%ERRORLEVEL%"=="0" echo Program is running
  tasklist /FI "IMAGENAME eq mc_com.exe" 2&gt;NUL | find /I /N "mc_com.exe" &gt;NUL
  if "%ERRORLEVEL%"NEQ"0" (D:\Software\Programs\MediaCompanion\mc_com.exe -e -m -v)
  </code></pre>
  
  <p>How do I get this to run mc_com.exe if it is not already running but if it is running to just end the script?</p>
  
  <p>Working Solution</p>
  
  <pre><code>tasklist|find /i "mc_com.exe" &gt;NUL
  if errorlevel 1  (start "" D:\Software\Programs\MediaCompanion\mc_com.exe -e -m -v)
  goto :eof
  </code></pre>