升级powershell7
搜索软件包
winget search powershell
升级
winget install Microsoft.PowerShell
应该在路径C:\Program Files\PowerShell\7\pwsh.exe
以管理员打开它
set-executionpolicy RemoteSigned
$OutputEncoding
Test-path $profile
如果为false,就创建一个
New-Item -Type file -Force $PROFILE
往这个文件写入
# powershell初始化加载 PSReadLine 模块
Import-Module PSReadLine
# 使用历史记录进行脚本提示
Set-PSReadLineOption -PredictionSource History
# alt在windows中有特殊用途,这里使用ctrl键代替
Set-PSReadLineKeyHandler -Chord "Ctrl+RightArrow" -Function ForwardWord