How do I interrupt a program run from CMD?

I am trying to get into C programming, but the larger the project get, the more often I want to interrupt programs I run from CMD. Usually when running for example Python from the CMD, I can interrupt the script using CTRL+C. This however does not work. I have seen people say you can use CTRL+BREAK/PAUSE, but my keyboard does not have those keys.

Is there any way I could interrupt C programs I run from CMD? Maybe using a custom keybind (to tell CMD CTRL+C is the same as CTRL+BREAK)?


If the CTRL + C doesn't work for you, use the CTRL + break, you should find break somewhere around your page up and pause keys, depending on what type of keyboard you're using. But CTRL + break usually works or even ESC


You can use AutoHotkey to make Ctrl+C send Ctrl+Break instead - or to have it send both - only in Command Prompt.

Here are AutoHotkey scripts for both:

  • Ctrl+C sends only Ctrl+Break:

    #IfWinActive, Command Prompt
    ^c::^CtrlBreak
    
  • Ctrl+C sends both Ctrl+Break and Ctrl+C:

    #IfWinActive, Command Prompt
    ~^c::^CtrlBreak
    

The tilde (~) makes the key retain also its original function. To use, simply install the program, put the script you want in a file and run it.