Windows PowerShell 是嵌入到多个主机中的脚本引擎。 最常见的主机是交互式命令行 powershell.exe
和交互式脚本环境 powershell_ise.exe
。
PowerShell 二进制名称
PowerShell 版本 6 及更高版本使用 .NET (Core)。 受支持的版本在 Windows、macOS 和 Linux 上可用。
从 PowerShell 6 开始,PowerShell 二进制文件名为适用于 Windows 的 pwsh.exe
和适用于 macOS 和 Linux 的 pwsh
。 可以使用 pwsh-preview
启动 PowerShell 预览版。 有关详细信息,请参阅关于 pwsh。
若要查找 PowerShell 7 的 cmdlet 参考文档和安装文档,请使用以下链接:
文档 | 链接 |
---|---|
Cmdlet 参考 | PowerShell 模块浏览器 |
Windows 安装 | 在 Windows 上安装 PowerShell |
macOS 安装 | 在 macOS 上安装 PowerShell |
Linux 安装 | 在 Linux 上安装 PowerShell |
若要查看其他 PowerShell 版本的相关内容,请参阅如何使用 PowerShell 文档。
从“开始”菜单运行
- 打开“开始”菜单,键入 Windows PowerShell,选择“Windows PowerShell”,然后选择“打开”。
从命令提示符处运行
在 Windows Command shell、Windows PowerShell 或 Windows PowerShell ISE 中,若要启动 Windows PowerShell,请键入:PowerShell
。
你还可以使用 powershell.exe
程序的参数来自定义会话。 有关详细信息,请参阅 about_PowerShell_exe。
使用管理员特权运行
打开“开始”菜单,键入 Windows PowerShell,选择“Windows PowerShell”,然后选择“以管理员身份运行”。
如何在早期版本的 Windows 上启动 Windows PowerShell ISE
使用以下任一方法启动 Windows PowerShell ISE。
从“开始”菜单运行
- 打开“开始”菜单,键入 ISE,选择“Windows PowerShell ISE”,然后选择“打开”。
在命令提示符处
在 Windows Command shell、Windows PowerShell 或 Windows PowerShell ISE 中,若要启动 Windows PowerShell,请键入:PowerShell_ISE
。 在 Windows PowerShell 中,可以使用别名 ise
。
使用管理员特权运行
选择开始,键入 ISE,右键单击 Windows PowerShell ISE,然后单击以管理员身份运行。
启动 32 位版本的 Windows PowerShell
除了 64 位版本外,64 位版本的 Windows 还包括 32 位版本的 Windows PowerShell,即 Windows PowerShell (x86)。 默认情况下运行 64 位版本。
但是,有时可能需要运行 Windows PowerShell (x86),例如使用需要 32 位版本的模块时,或者远程连接到 32 位计算机时。
若要启动 32 位版本的 Windows PowerShell,请使用以下任何过程。
- 选择开始,键入 Windows PowerShell,选择 Windows PowerShell (x86),然后选择打开。