將目前的 PowerShell 從 5.x.x 升級至 7.2.6 。
$PSVersionTable: 查詢版本與重要資訊。
-
winget search Microsoft.PowerShell: 藉由 Winget 來查詢目前提供的版本。假如這是查詢結果:
Name Id Version Source --------------------------------------------------------------- PowerShell Microsoft.PowerShell 7.2.6.0 winget PowerShell Preview Microsoft.PowerShell.Preview 7.3.0.6 winget -
winget install --id Microsoft.Powershell --source winget: 藉由 Winget 來安裝想要的版本。
-
關閉目前開啟的 PowerShell。(視情況重新開機)
-
$PSVersionTable: 查詢版本與重要資訊。