21

When in the command prompt: I am looking for a Windows equivalent of CTRL+C in unix and mac to force exit a program in a command prompt. Sometimes my program would just infinitaly wait for... something and I would like to close it without hitting CTRL+ALT+DELETE and force quitting the windows command prompt. Thanks!

1
  • Ctrl+D also works sometimes.
    – William
    Oct 20, 2015 at 15:08

4 Answers 4

20

Ctrl + C will stop a program running from the command prompt, similar to other operating systems.

To force kill a process from the command prompt, use the following command:

taskkill /F /IM process.exe

/F will force termination, /IM means you're going to provide the executable (image) name, and process.exe is the process to end.

3
  • 1
    Make sure to use "process name.exe" if it has a space!
    – Phoshi
    Oct 20, 2009 at 18:16
  • How to get arround ERROR: The process "remoting_host.exe" with PID 8164 could not be terminated. Reason: Access is denied. Sep 1, 2019 at 16:19
  • Found it myself, going to Services and killing the service with the PID that was returned above. Sep 1, 2019 at 16:23
15

Actually, it's Ctrl+C on Windows too. Ctrl+Break usually works as well, but with some commands it has some interesting differing semantics compared to Ctrl+C (see ping -t for example).

2
  • Just wanted to add that Ctrl+Pause also works. Yes, Pause and Break are the same key for most computers, but in my case, and I am sure others, I have to press the FN key if I want to use the Break portion of that key. So, pressing Ctrl + FN + Break works, but so does Ctrl + Pause, which is great for those of us that want to use as few keys as possible.
    – Rolo
    Jun 6, 2014 at 14:16
  • According to my experience most program only stops by ctrl+break and less stop with ctrl+c Apr 21, 2016 at 18:37
5

Normally, that would be CTRL-BREAK (the PAUSE/BREAK key on a 101-key keyboard) but I think this can be disabled.

Give it a shot.

But this isn't really a programming question so I'm voting to shift it to superuser.

1
  • 1
    Do you have any idea if there's an equiv. for a macbook keyboard? thanks!
    – Anonymous
    Oct 19, 2009 at 4:12
0

Command to exit command prompt:

taskkill /IM cmd.exe

You must log in to answer this question.