pwsh7配置自动补全
命令行安装pwsh7
## /quiet 无干预的安装
## ENABLE_PSREMOTING=1 启用 PowerShell 远程管理功能
## REGISTER_MANIFEST=1 注册应用程序清单
## ADD_PATH=1 添加系统环境变量 PATH
msiexec.exe /package PowerShell-7.4.3-win-x64.msi /quiet ENABLE_PSREMOTING=1 REGISTER_MANIFEST=1 ADD_PATH=1
pwsh7安装PSReadLine智能补全插件
开启powershell远程执行权限
# 开启powershell远程执行权限
Set-ExecutionPolicy RemoteSigned
# 同意更改 输入Y
检测是否有配置好文件
# 检测是否有配置好文件
Test-path $profile
如果为false
手动创建profile
# 手动创建profile
New-item –type file –force $profile
# 使用记事本打开profile文件
notepad $profile
将下面的内容粘贴到profile
中;
# 点击 Tab 时显示所有选项的可导航菜单
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete
# 箭头键的自动完成
## 设置向上键为后向搜索历史记录
Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward
## 设置向下键为前向搜索历史纪录
Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward
# 自动建议
Import-Module PSReadLine
Set-PSReadLineOption -PredictionSource History
安装PSReadLine自动补全
项目地址: https://github.com/PowerShell/PSReadLine
参考: https://www.cnblogs.com/world-explorer/p/16500936.html
https://www.cnblogs.com/whiter001/p/15226132.html
# 安装PowerShellGet
Install-Module -Name PowerShellGet -Force
# 安装依赖
Install-Module -Name GuiCompletion
# 安装PSReadLine
Install-Module PSReadLine -Force
初始化PSReadLine
# 初始化
Set-PSReadLineOption -PredictionSource History
使用bash样式
# 使用bash样式
Set-PSReadLineKeyHandler -Key Tab -Function Complete