Window PowerShell 检查更新

查看当前版本

使用 PowerShell 终端输入指令, 终端将显示您当前的 PowerShell 版本号。

$PSVersionTable.PSVersion

搜索最新版本

winget 是 Windows 自带的包管理器

winget search Microsoft.PowerShell

这个会显示最新版本的正常办和预览版

Name               Id                           Version Source
--------------------------------------------------------------
PowerShell         Microsoft.PowerShell         7.3.6.0 winget
PowerShell Preview Microsoft.PowerShell.Preview 7.4.0.3 winget

安装新版本

# 使用 Winget 安装 PowerShell
winget install --id Microsoft.Powershell --source winget

# 使用 Winget 安装 PowerShell 预览版
winget install --id Microsoft.Powershell.Preview --source winget

验证更新

直接打开 powershell 并且输入$PSVersionTable.PSVersion

可能看到版本号并没有改变 原因:5.1 和 7 版本可以共存