I think the problem might be in the way you're starting the batchfile - you want it to return control to prog A once it's called prog B. I think using "start" might do the trick (and avoid having to use /f on taskkill). Perhaps someone can remember better. But essentially you need to find a way to start everything and return control to program A.
*EDIT:*
Code:
START
Start a specified program or command in a separate window.
syntax
START "title" [/Dpath] [options] [command] [parameters] key
WHAT to run
path : Starting directory
command : The NT Command, Batch file or executable program to run
parameters : The parameters passed to the command
HOW to run it
/MIN : Minimized
/MAX : Maximized
/WAIT : Start application and wait for it to terminate
/LOW : Use IDLE priority class
/NORMAL : Use NORMAL priority class
/HIGH : Use HIGH priority class
/REALTIME : Use REALTIME priority class
"title" : Text for the CMD window title.
/B : Start application without creating a new window. In this case ^C will be ignored - leaving ^Break as the only way to interrupt the application
/I : Ignore any changes to the current environment.
Options for 16-bit WINDOWS programs only
/SEPARATE Start in separate memory space (more robust)
/SHARED Start in shared memory space (default)
... so perhaps if you can use 'start <batchfile>' from program A, it will allow control to return to the calling program (and stop it being 'not responding')?
You need the batchfile to be running completely separately from prog A, so when the batchfile kills prog A it doesn't kill itself! I think using 'start', or maybe even 'cmd.exe <batchfile>' will be the best way to ensure it's separate.