Batch file press any key to continue

broken image
broken image
broken image

Here is a sample script that demonstrates the issue: off

broken image

Is there a way to properly break a batch script's execution easily while it is currently in a PAUSE?Įdit: It looks like PAUSE works fine in simple scripts, as indicated by However, if you have multiple PAUSE statements nested inside of a FOR iteration, then you can't break in the middle of the FOR iteration – only at the end. I know I can simply kill/close the command window, but it's a little annoying to navigate back to the correct path in a new command-window every time. However, I discovered that typing CTRL+C during a PAUSE command to cancel execution is simply interpreted as a key to continue execution, rather than breaking the script as intended. I am using PAUSE commands between statements to watch the behavior of the script.

broken image

I have a command-line window open to the root path of the script, so I can type myscript.bat to fire it off for testing. I'm developing a complex, long-running batch script, and came upon a little issue when debugging.