Jo22 wrote on Yesterday, 07:41:
Btw, if memory serves, in the DOS 3.x days it was already possible to use Control-C to interrupt processing of start-up files (or batch files in general).
But it required BREAK=ON in config.sys, I vaguely remember.
BREAK=ON and the handling of Ctrl-C is an interesting topic in itself. The basic idea of Ctrl-C is obviously to cancel the current task (i.e. DOS program), but to do it at a point in time that is "safe" (for some definition of safe). DOS doesn't use any interrupt-driven mechanism to detect Ctrl-C, but at "some convenient time", it asks the BIOS whether the first character in the keybaord buffer is Ctrl-C. This means Ctrl-C will have no effect if there are unhandled keypresses before in the BIOS keyboard buffer. That's actually where Ctrl-Brk comes in handy: If you push Ctrl-Brk, the BIOS keyboard interrupt handler clears all unconsumed input and triggers Int 1B, which is intended to be hooked by the operating system. Either the BIOS by itself or the DOS Int 1B handler (if there is one) will then place a Ctrl-C event into the keyboard buffer, so it will be seen by DOS at the next "convenient time". The setting BREAK influences what time DOS considers a convenient time to cancel a program. By default (BREAK OFF), programs may only be cancelled when the try to read data from the keyboard or (IIRC) print to the screen (using DOS functions). This ensures you can't interrupt a program while it is updating a file (unless it prints progress messages), so file integrity is kind-of guaranteed even if someone presses Ctrl-C.
On the other hand, this means, you can not cancel long-running file operations, which may be inconvenient. That's why DOS offers the more aggressive choice (BREAK ON) to not only cancel during console I/O, but also during file I/O.
Whenever a program executed from a batch file is cancelled using Ctrl-C (or Ctrl-Brk, which uses the same canellation path in the end), COMMAND.COM (responsible for handling batch files) will ask the user whether the batch file should continue executing the next command after the cancelled program, or whether the batch execution should be terminated. This is what you are referring to. To make use of this feature to prevent a "bad" startup process from locking up your system, you would need to Issue Ctrl-Brk (or Ctrl-C) before the last convenient point in time before the "bad operation". A tool like CTCM prints a banner message before trying to configure plug-and-play cards, so it could actually work (even with BREAK OFF, if I remember correctly that BREAK OFF still allows breaking on screen output) - if CTCM.EXE were called from AUTOEXEC.BAT to configure PnP cards. Actually, it isn't, instead, it is loaded from CONFIG.SYS for this purpose, and the BREAK mechanism doesn't apply while loading device drivers, I think. At least, as COMMAND.COM isn't involved in parsing CONFIG.SYS, you will not get a message like "terminate batch file (Y/N)" if you interrupt a previous process.