Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I've got a batch file that runs an executable in the middle of some other batch commands. This executable is, basically, an endless loop producing some output. The only way to terminate the executable is to do a Ctrl-C (or Ctrl-Break, or kill using Task Manager.) Unfortunately, when I press Ctrl-C, I also get the annoying message
"Terminate batch job (Y/N)?"
and I press N every time to resume the batch file. Is there a way to suppress this message, and just carry on with the batch commands following it?

No at all, as the request is issued by an interrupt handler and so that can't be intercepted in anyway (to manipulate the Ctrl-C handler is a highly risky practice even in plain DOS).

Thanks Ivo. I was thinking, maybe I can do it like this:
Write a small utility program in C++ that is called, say, run.exe, and called in the batch like this:
run realprogram args
It would do this:
Define a Ctrl-C handler that ignores the ctrl-c and throws it away.
Then in main():-
set up Ctrl-C handler
execute command line given as argument
exit applicationSo this way I'm not interfering with the ctrl-c handler in cmd.exe, but my own ctrl-c handler in a subprocess that run my own program.
Has anyone done anything like this?

I'm not an interrupts handler's guru, but be aware the process involved is driven by the nature of your application. In other words if your Run.exe is a DOS application then it communicates qith the kernel via int 21h (emulated by NTVDM) otherwise a true Win exe exploits API interface.
In the first case you may get the goal, beyond my know-how the other one.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |