title: Launch if Process Not Running, Windows Command Line
body: <p>I want to auto-launch an application (specifically Outlook.exe) if it is not already running. I wanted to do this through the Windows 7 task scheduler, which meant the solution <a href="https://stackoverflow.com/questions/162291/how-to-check-if-a-process-is-running-via-a-batch-script">here</a> did not work when I tried to execute it on one line by replacing the newline with &amp;. It would launch outlook no matter if it was running or closed.</p>
  
  <p><code>tasklist /FI "IMAGENAME eq outlook.exe" 2&gt;NUL | find /I /N "outlook.exe"&gt;NUL &amp; if "%ERRORLEVEL%"=="0"  "C:\Program Files (x86)\Microsoft Office\Office14\OUTLOOK.EXE"</code></p>