So, I have 2 .bat files (lets call them A and B) A is the Main Programm and B is running in the Background. But now i want to Close B via typing in A "Close B" I want it to work without additional files. I tried using "call" but it didnt work.
1 Answer
Start B with certain title, like this:
start "_operationB_" /MIN cmd /c call cmdB.bat
And in A you can locate B by its title and close it:
taskkill /FI "WINDOWTITLE eq _operationB_"
-
1You could also use the
title
command from B to make it more distinguished, and you can set the title at any point within the batch file, so you could, for example, use A to close B only if it's at a certain point where it might stall (title This_might_stall
).– shawnDec 25, 2018 at 20:22