I found this solution on your site but my needs are slightly different and I could not find a solution in the archive.

Here is a script that starts Notepad and then MS Paint. If you terminate Paint, then the CMD proceeds to kill Notepad.

start notepad.exe
taskkill /IM notepad.exe

I need for an app to start when another closes instead. So maybe someone can edit the above to: start mspaint when notepad closes.

Let me also explain my entire process because it might be possible to include all in one batch file??

  1. If App#1 starts, then App#2 must also start
  2. If App#1 closed then App#3 must start

This example .bat file will demonstrate how this is done:

start "App1" Echo App1. Close me manually!
start "App2" Echo App2. Close me manually!
timeout /T 2 /nobreak >nul
tasklist.exe /fi "WINDOWTITLE eq App1" | find ":" >nul
if errorlevel 1 goto waitapp1
start "App3" Echo App3. Close me manually!
echo Finished!

You may use other filters of the tasklist command. Perhaps you would prefer using IMAGENAME over WINDOWTITLE.


You can experiment with and without start before the app names to see the difference.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.