Computing.Net > Forums > Programming > Suppressing "Terminate batch j

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Suppressing "Terminate batch j

Reply to Message Icon

Name: klint
Date: May 22, 2008 at 06:28:47 Pacific
OS: Windows XP SP2
CPU/Ram: n/a
Product: n/a
Comment:

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?



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: May 22, 2008 at 08:37:20 Pacific
Reply:

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).


0

Response Number 2
Name: klint
Date: May 22, 2008 at 09:32:42 Pacific
Reply:

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 application

So 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?


0

Response Number 3
Name: IVO
Date: May 22, 2008 at 12:24:40 Pacific
Reply:

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.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Suppressing "Terminate batch j

BATCH: 'goto labels' inside curlys www.computing.net/answers/programming/batch-goto-labels-inside-curlys/16500.html

Can some batch do this? www.computing.net/answers/programming/can-some-batch-do-this/14425.html

Windows DLL function list?? www.computing.net/answers/programming/windows-dll-function-list/11882.html