2

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)?

2

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

  • Read my post again ;) The first one does not work and the latter is not on my keyboard – Wilfred Aug 4 '17 at 23:40
  • what type of computer are you using? e.g. Hp dv6, Dell XPS 13 – antzshrek Aug 4 '17 at 23:49
  • I am using a Qompaq Presario CQ57 laptop, if that helps anything ^^ – Wilfred Aug 4 '17 at 23:54
  • 1
    google image search looks like Pause is fn + right shift on the cq57 keyboard. Add a ctrl to that and you might get the equivalent of ctrl + break – Wumpus Q. Wumbley Aug 5 '17 at 0:22
2

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.

  • Works like a charm! Thanks! Maybe not the most elegant way, but it does the trick! – Wilfred Aug 6 '17 at 10:35
1

CTRL+C should work as long as it is a command shell / window, i use CTRL+C to stop CMD processes and batch files, problem is sometimes it asks if you want to exit in a app specific way (eg: Batch = "Terminate batch job (Y/N)?"),then when you type "y" it exits so because i would not recommend this if you are debugging your'e C file. however i believe there are programs to edit key binds and / or bind a certan key to somthing (eg numpad7 = windows+R) ill have a look into it and edit this later on.

EDIT:

ive found this wich may be useful: http://lifehacker.com/5883003/the-best-key-remapper-for-windows i don't know if it will work but its the best one i could find. hope this helps

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.