How to Stop a Batch File in MS-DOS 6.22

Running a batch file in MS-DOS 6.22 can sometimes lead to unintended loops or long-running processes that need to be interrupted immediately. This guide explains the exact keyboard combinations required to abort batch script execution safely, how the operating system responds to the interrupt signal, and how to ensure the system listens for termination commands.

The primary keyboard combination to halt execution of a batch file in MS-DOS 6.22 is Ctrl + C. Alternatively, you can use Ctrl + Break. Both shortcuts send an interrupt signal directly to the command interpreter (COMMAND.COM).

When you press Ctrl + C or Ctrl + Break while a batch file is executing, MS-DOS pauses the script and displays the following prompt:

Terminate batch job (Y/N)?

To permanently stop the batch file, press the Y key. MS-DOS will immediately exit the script and return you to the standard command prompt (e.g., C:\>). If you press N, MS-DOS will abort only the currently executing line and continue processing the remaining commands in the batch file.

In standard MS-DOS 6.22 configurations, the operating system only checks for Ctrl + C during standard input, output, printer, and serial communication operations. If a batch file is performing heavy disk read/write operations or running intensive external commands, the system might not register the key combination immediately.

To make MS-DOS check for the cancellation command more frequently, you can enable extended break checking by typing BREAK ON at the command prompt, or by adding the line BREAK=ON to your CONFIG.SYS file. This ensures that pressing Ctrl + C or Ctrl + Break halts the batch file without delay.