PowerShell 是微軟在其 Windows 操作系統上提供的強大腳本語言,可用于通過命令行界面自動化各種任務,適用于 Windows 桌面或服務器環境。而 PowerShellGet 是 PowerShell 中的一個模塊,提供了用于從各種來源發現、安裝、更新和發布模塊的 cmdlet。
本文將介紹如何在 PowerShell 中安裝 PowerShellGet 模塊。
前提條件:
你的 Windows 或 Linux 必須安裝了 PowerShell,才能使用本文提供的命令,而且你的 PowerShell 的版本需要 5.0 以上。
第一步:打開并檢查 PowerShell 版本
在 Windows 10 或 11 中,右鍵單擊 開始 菜單按鈕,選擇 “Windows PowerShell (管理員)”。或者,用戶也可以點擊開始菜單附近的搜索欄來搜索它。
現在,檢查你的 PowerShell 版本,確認其版本號為 5.0 或更高版本,才能使用 PowerShellGet。
$PSVersionTable.PSVersion