Our application uses 3 databases, one with client data, and two with configuration data. To prevent destroying client data, the batch file that deletes the client database has first a warning message, and then a pause.

I just called the delete client database on my machine by accident (no loss; it was just a copy), and when the pause prompt came, I just pressed Ctrl+C. Instead of directly terminating, Windows asked me if I want to Terminate batch job.

So I just pressed Ctrl+C again because, IMO, Ctrl+C means Do NOT carry on, and because I still had my fingers on those keys anyway. The batch file just carried on and deleted the database anyway (Meaning I need to restore it, making my PC unusable for two hours).

Why does Windows CMD.EXE thinks that when I press CTRL+C on the Terminate batch job prompt, that means that I actually want to carry on (in other words, why Ctrl+C in this context means Y, rather then N)?

In Linux, the shell actually does what you are asking it, which is to terminate the script without asking a pointless question. Nobody ever presses Ctrl+C in a DOS box by accident (unless they thought they were in a text editor, rather then a DOS box).

  • 4
    I think its a simple as CTRL+C has cancelled the "prompt"! – cjb110 Apr 10 '14 at 9:18
  • as @cjb110 says the CTRL+C has cancelled the program that is showing the prompt or the batch file that is showing it to you. If you have batch files calling other batch files it may only cancel the child one. – rob Apr 10 '14 at 10:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.