BREAK: Sets or clears extended CTRL+C checking.
The command: "BREAK" is on Windows 11, 10, .. available
The examples for the command "BREAK"
command is now only used in the Windows command line (cmd) for batch files and has no effect on modern versions of Windows, unlike previous operating systems such as Windows XP. In Windows XP, the command was used to turn Ctrl+C (cancel) monitoring on or off in a batch file.
Here are simple examples using the "BREAK" command in a batch file:
Example 1: Using BREAK in a simple batch file
echo Before BREAK
echo After BREAK
This example shows a simple batch file. The `BREAK`
command runs but has no effect on modern versions of Windows. Lines of text are output before and after the `BREAK`
Example 2: BREAK in a FOR loop
for /L %%i in (1, 1, 10) do (
if %%i == 5 (
echo Cancel the loop.
This example demonstrates the use of `BREAK`
in a FOR loop. The loop will run from 1 to 10, and when the loop variable `%%i`
reaches the value 5, the loop will be terminated prematurely with `BREAK`
. However, this command has no effect in modern versions of Windows.
It is important to note that the examples are intended to illustrate the `BREAK`
command, which may no longer be relevant in modern environments. If there are any further questions or additional explanations are needed, I am available!
"BREAK" Excerpt from Microsoft Windows Help
Microsoft Windows [Version 10.0.19045.3693]
(c) Copyright 1985-2023 Microsoft Corp.
Sets or Clears Extended CTRL+C checking on DOS system
This is present for Compatibility with DOS systems. It has no effect
under Windows XP.
If Command Extensions are enabled, and running on the Windows XP
platform, then the BREAK command will enter a hard coded breakpoint
if being debugged by a debugger.
Important information, tips for the "BREAK" command
Yes, there are certain aspects one should pay attention to when using the `BREAK` command in batch files:
1. Valid in batch files only: The `BREAK` command is specific for use in batch files on the Windows command line. It has no effect outside of batch files.
2. Not always supported: On modern versions of Windows, especially starting with Windows XP, the `BREAK` command generally has no practical use. It is present to ensure compatibility with older batch files.
3. Use in loops: The command is often used in loops like `FOR` to terminate the loop early when a certain condition is met.
4. Debugger functionality on Windows XP: On Windows XP it is mentioned that the `BREAK` command can also set a hardcoded breakpoint for a debugger when command extensions are enabled.
5. Availability in future versions: It is important to note that the use of `BREAK` may not be recommended for future versions of Windows. Therefore, new scripts or automation tasks should consider using more modern mechanisms.
In summary, `BREAK` should be used with caution, especially when targeting older systems. In modern scenarios, there may be better alternatives for controlling batch files and scripts.