Is there a way to use ctrl-c
in a batch-file without the need for the user to input ctrl-c
?
In batch files and command prompt, the input
ctrl-c
will break a command like a for
loop or a batch job in general. I was messing around to see if the actual break
command had any use (it really doesn't, even when command extensions are on it is useless) and I thought "is there a way to write ctrl-c in a batch file or on the command line?" The first thing that I tried was making a step for
loop using for /l
with an if
statement in the do
section saying if %a LEQ 9500 (^^C)
as ^C
is how it is shown when you inputctrl-c
to break something. When I ran the full command (for /l %a in (10000, -1, 1) do (if %a LEQ 9500 (^^C))
) it did the error '^C' is not recognized as an internal or external command, operable program or batch file.
when %a
got below 9500. I also tried this same thing in a batch file with %%a
and it had the same error. I then tried using break
as well with extensions on and off and still it didn't work.
What I want to learn
So overall I want to figure out the command-equivalent of ctrl-c
and how to use it.