简体   繁体   English

如何使用热键清除 Windows 命令提示符窗口中的屏幕?

[英]How to clear screen in Windows command prompt window with a hotkey?

I have searched a lot to find a way (keyboard shortcut) to clear the screen of the console window of cmd on Windows 10. I tried Ctrl+L and Ctrl+K and ESC , but nothing worked for me and I didn't find any satisfied solution.我已经搜索了很多找到一种方法(键盘快捷键)来清除 Windows 10 上cmd的控制台窗口的屏幕。我尝试了Ctrl+LCtrl+KESC ,但没有任何效果对我有用,我没有找到任何满意的解决方案。

Thanks a lot for the AutoHotkey script.非常感谢AutoHotkey脚本。
I modified the script to input Python script to clear the screen when using scrapy shell like that我修改了脚本以输入Python脚本以在使用像这样的scrapy shell时清除屏幕

Send from os import system{Enter}
Send cls = lambda: system)'cls'({Enter}
Send cls)({Enter}

It worked well but I noticed the value 0 at the top of the window.它运行良好,但我注意到窗口顶部的值0

The console window after execution of AutoHotkey script with as blinking caret symbol.执行AutoHotkey脚本后的控制台窗口,其中作为闪烁的插入符号。

0
>>> █

How can I remove that zero?我怎样才能删除那个零?

The simplest way of clear window in command prompt is typing: cls + enter在命令提示符中清除窗口的最简单方法是键入:cls + enter

Ecs is a key to exit input of command prompt, it does noting on clear window Ecs是退出命令提示符输入的键,它不会在清除窗口上注明

Ctrl + L and Ctrl + K are not correct short key in Linux command prompt. Ctrl + L 和 Ctrl + K在 Linux 命令提示符下不是正确的快捷键。 If you really want to make it a short cut key of cls, you can use AutoHotKey to write a short script如果你真的想让它成为cls的快捷键,你可以使用AutoHotKey写一个简短的脚本

 ; ------------------------------------------------------------------------- ; Cntr-L should clear screen ; ------------------------------------------------------------------------- #IfWinActive ahk_class ConsoleWindowClass ^L:: Send cls{Enter} return #IfWinActive

Official website of autohotkey: https://www.autohotkey.com/ autohotkey 官网: https ://www.autohotkey.com/

Windows 10 + python 3.9 clear command prompt script: import os os.system('cls') Windows 10 + python 3.9 清除命令提示脚本:import os os.system('cls')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM