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 here did not work when I tried to execute it on one line by replacing the newline with &. It would launch outlook no matter if it was running or closed.
tasklist /FI "IMAGENAME eq outlook.exe" 2>NUL | find /I /N "outlook.exe">NUL & if "%ERRORLEVEL%"=="0" "C:\Program Files (x86)\Microsoft Office\Office14\OUTLOOK.EXE"