windows - Start programs via command-line, but only if not already running - Super User

PHOTO EMBED

Sun Dec 25 2022 08:21:53 GMT+0000 (Coordinated Universal Time)

Saved by @savabeh191

@echo off      
tasklist /FI "IMAGENAME eq outlook.exe" | find /i "outlook.exe"      

IF ERRORLEVEL 2 GOTO LOOP2
IF ERRORLEVEL 1 GOTO LOOP1 

:LOOP1 
  start notepad.exe
goto EXIT     

:LOOP1 
  start outlook.exe 
goto EXIT 

:EXIT
content_copyCOPY

https://superuser.com/questions/654088/start-programs-via-command-line-but-only-if-not-already-running