Linux-like Ctrl-C (KeyboardInterrupt) for the Windows cmd line?
Asked Answered
R

4

26

I've been forced into using a command line in windows and wondered if there were Linux-like keyboard shortcuts? I googled and didn't find what I was looking for.

Things like ^C, ^Z and such?

Renowned answered 29/4, 2009 at 1:31 Comment(0)
W
16

You can trap ^C on Windows with SIGINT, just like Linux. The Windows shell, such as it is, doesn't support Unix style job control (at least not in a way analogous to Unix shells), and ^Z is actually the ^D analog for Windows.

Wayward answered 29/4, 2009 at 1:36 Comment(1)
I don't know about Unix style job control, but now in Windows you have Powershell Background Jobs.Limassol
S
35

Try Ctrl+Break: some programs respond to it instead of Ctrl+C. On some keyboards Ctrl+Break translates to Ctrl+Fn+Pause.

Note also that nothing can cancel synchronous network I/O (such as net view \\invalid) on Windows before Vista.

Shotgun answered 29/4, 2009 at 1:51 Comment(0)
W
16

You can trap ^C on Windows with SIGINT, just like Linux. The Windows shell, such as it is, doesn't support Unix style job control (at least not in a way analogous to Unix shells), and ^Z is actually the ^D analog for Windows.

Wayward answered 29/4, 2009 at 1:36 Comment(1)
I don't know about Unix style job control, but now in Windows you have Powershell Background Jobs.Limassol
M
7

There are two keyboard combinations that can be used to stop process in Windows command line.

  • Ctrl+C is the "nicer" method. Programmers can handle this in software. It's possible to write programs that ignore Ctrl+C as SIGINT signal completely, or handle Ctrl+C like a regular keyboard combination.

  • Ctrl+break is the "harder" method, always sends SIGBREAK signal and cannot be overridden in software.

Multiplier answered 11/9, 2014 at 11:26 Comment(0)
J
0

Ctrl-C does a similar thing in windows as it does in linux.

Jewelry answered 29/4, 2009 at 1:33 Comment(3)
In Linux Ctrl-C can halt many stuck processes, but it seems that my stuck windows command is Ctrl-C proof! Thanks though!Renowned
This is simply not trueUtter
@Utter which bit is the "not true" bit?Jewelry

© 2022 - 2024 — McMap. All rights reserved.