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 1


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_"
  • 1
    You 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).
    – shawn
    Dec 25, 2018 at 20:22

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.