在Powershell控制台中使用CTRL + D退出并使用CTRL + L退出cls [英] Use CTRL + D to exit and CTRL + L to cls in Powershell console
问题描述
我正在尝试
CTRL + D -退出Powershell控制台
CTRL + D - exit Powershell console
和
CTRL + L -清除屏幕
就像在bash中一样.
like in bash.
到目前为止,我已经看到我们可以定义
So far, I have seen that we can define
function ^D {exit}
但这意味着我必须执行CTRL + D,然后按Enter才能使其正常工作.
but that means I have to do CTRL+D and then hit enter for it to work.
而且,它甚至不让我定义
Also, it doesn't even let me define
function ^L {exit}
反正有没有在默认Powershell控制台中添加这些键绑定?
Is there anyway to add these key bindings in the default Powershell console?
推荐答案
PowerShell中有一个新的库 PSReadline
v3.0 模拟GNU Bash选项卡的完成和键绑定.甚至 CTRL + R 都可以进行反向增量搜索.正是我想要的.
There is a new library PSReadline
for Powershell v3.0 that emulates the GNU Bash tab completion and key bindings. Even CTRL + R for reverse incremental search works. Exactly what I wanted.
这篇关于在Powershell控制台中使用CTRL + D退出并使用CTRL + L退出cls的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!