Skip to content

PowerShell 安装

本教程以 PowerShell 7+ 为主,推荐在所有平台统一使用。常见安装方式:

  • Windows:
    • Microsoft Store 或者下载官方 MSI 安装包
    • 包管理器:winget install Microsoft.PowerShell
  • Linux:
    • 使用发行版包管理器(如 apt、dnf、zypper)或 tar 包
  • macOS:
    • Homebrew:brew install --cask powershell 或 brew install powershell

检查版本:

powershell
$PSVersionTable

启动方式:

  • Windows:开始菜单搜索 PowerShell 或在 Windows Terminal 中添加 PowerShell 配置文件
  • VS Code:安装 PowerShell 扩展(ms-vscode.PowerShell),内置终端选择 PowerShell

更新帮助(首次建议执行):

powershell
Update-Help -UICulture zh-CN -Force

注意:企业环境可能受执行策略(Execution Policy)限制,若需运行本地脚本,请了解 Set-ExecutionPolicy 与签名策略,遵守组织安全规范。

本站内容仅供学习和研究使用。