Win11 PowerShell 配置自动提示功能

561 阅读1分钟

最终效果如下:

image.png

安装PSReadLine

PowerShell中输入

Install-Module PSReadLine -RequiredVersion 2.1.0 -Scope CurrentUser

配置PowerShell

PowerShell的配置文件中添加如下内容:

 Import-Module PSReadLine
 Set-PSReadLineOption -PredictionSource History

PowerShell的默认配置文件为:

~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1

也可以直接vim $PROFILE.CurrentUserCurrentHost进行编辑

参考

  1. PowerShell 配置自动提示
  2. How to set up PowerShell prompt with Oh My Posh on Windows 11