Clear Powershell screen when typing prompt not available

Clear Powershell screen when typing prompt not available

I came from using Linux where you can clear the screen with Ctrl+L. After reading a bit on this form, I see people have been clearing powershell by typing in "CLS" or using binding "CLS" with autohotkey.

However, this is not possible when something is running in the foreground (typing prompt not available). Is there any way to clear powershell screen in this case?

答案1

This is not specific to powershell, as it affects anything running in the built-in terminal.

Unfortunately, there is no way to do this from that built-in terminal that the .EXE for powershell, cmd, python, etc will start. (ctrl+L clears the screen in powershell, but must wait for process to finish).

However, the new Windows Terminal does support setting a hotkey for the "Clear buffer" action. This behaves like you'd expect, with no need to wait for the process to finish:

wt settings menu

If this helped, please vote up the detailed WT-specific answer here too: https://superuser.com/a/1628815/673426

相关内容