首页 > 系统服务 > 详细

如何用快捷键关闭power shell

时间:2021-03-30 15:11:58      阅读:21      评论:0      收藏:0      [点我收藏+]

While Alt+Space, then c works as pointed out above without any changes, it still requires two key strokes. You can define your own exit shortcut in PowerShell 5.0 and up by addding a Set-PSReadLineKeyHandler command to your Powershell profile. While this does require editing your PS Profile, once set up it works for all future sessions of PowerShell. As an example,

  1. Open a PowerShell terminal window and type the following to edit your PowerShell Profile file:

    notepad $Profile

This will open your Powershell profile. If you‘d like this to work for all users, edit the AllUsers profile which is located at $PROFILE.AllUsersCurrentHost. For more information on the PS profile see this Microsoft reference page.

  1. Add the following to the first line of the profile (ViExit is only available in PS 5.1):

    Set-PSReadlineKeyHandler -Chord Alt+F4 -Function ViExit

This defines the Alt-F4 as the exit key command. If you‘d like to use Ctrl-D instead use this line:

Set-PSReadlineKeyHandler -Chord Ctrl+d -Function DeleteCharOrExit

Now close the PowerShell terminal and reopen. The shortcut keys defined above (Alt+F4 or Ctrl+d as applicable) should now work.

 

参考:https://superuser.com/questions/1388293/what-is-a-keyboard-shortcut-for-closing-a-windows-powershell-window 

如何用快捷键关闭power shell

原文:https://www.cnblogs.com/profesor/p/14596508.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!