ECHO OFF taskkill /F /IM "plus.exe" >closed.txt taskkill /F /IM "plusrun.exe" >>closed.txt tasklist /FI "IMAGENAME eq plus*" >tasks.txt find /I "Plusrun.exe" tasks.txt >NUL if "%ERRORLEVEL%"=="0" (goto:task_run) find /I "Plus.exe" tasks.txt >NUL if "%ERRORLEVEL%"=="0" (goto:task_run) goto:End_of :task_run echo The following tasks were not closed successfully >tasks2.txt type tasks.txt >>tasks2.txt echo >>tasks2.txt echo The following tasks were closed successfully >>tasks2.txt type closed.txt >>tasks2.txt start "" notepad tasks2.txt goto:EOF :End_of echo The above processes were closed successfully >>closed.txt start "" notepad closed.txt