Linuxlike Ctrl-C (KeyboardInterrupt) for the Windows cmd line?

ぃ、小莉子 提交于 2019-12-18 14:17:32

问题


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? Thanks all!


回答1:


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.




回答2:


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.




回答3:


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.




回答4:


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



来源:https://stackoverflow.com/questions/800521/linuxlike-ctrl-c-keyboardinterrupt-for-the-windows-cmd-line

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!