启动 Windows PowerShell
Windows PowerShell 是一个嵌入到多个主机中的脚本引擎 .DLL
。 启动的最常见主机是交互式命令行 powershell.exe
和交互式脚本环境 powershell_ise.exe
。
若要在 Windows Server 2012 R2、Windows 8.1、Windows Server 2012 和 Windows 8 上启动 Windows PowerShell,请参阅 Windows 中的常见管理任务和导航。
PowerShell 已重命名二进制文件
PowerShell 版本 6 及更高版本使用 .NET Core。 受支持的版本在 Windows、macOS 和 Linux 上可用。
自 PowerShell 6 起,PowerShell 二进制文件已分别重命名为 pwsh.exe
(适用于 Windows)和 pwsh
(适用于 macOS 和 Linux)。 可以使用 pwsh-preview
启动 PowerShell 预览版。 有关详细信息,请参阅关于 pwsh。
若要查找 PowerShell 7 的 cmdlet 参考文档和安装文档,请使用以下链接:
文档 | 链接 |
---|---|
Cmdlet 参考 | PowerShell 模块浏览器 |
Windows 安装 | 在 Windows 上安装 PowerShell |
macOS 安装 | 在 macOS 上安装 PowerShell |
Linux 安装 | 在 Linux 上安装 PowerShell |
若要查看其他 PowerShell 版本的相关内容,请参阅如何使用 PowerShell 文档。
如何在早期版本的 Windows 上启动 Windows PowerShell
本部分介绍了如何在 Windows 7、Windows Server 2008 R2 和 Windows Server 2008 上启动 Windows PowerShell 和 Windows PowerShell 集成脚本环境 (ISE)。 还介绍了如何在 Windows Server 2008 R2 和 Windows Server 2008 上的 Windows PowerShell 2.0 中启用 Windows PowerShell ISE 的可选功能。
使用以下任一方法来启动已安装的 Windows PowerShell 3.0 或 Windows PowerShell 4.0 版本(如果适用)。
在“开始”菜单中
- 单击“开始”,键入 PowerShell,然后单击“Windows PowerShell”。
- 在“开始”菜单中,依次单击“开始”、“所有程序”、“附件”、“Windows PowerShell”文件夹,然后单击“Windows PowerShell”。
在命令提示符处
在 Windows Command shell、Windows PowerShell 或 Windows PowerShell ISE 中,若要启动 Windows PowerShell,请键入:PowerShell
。
你还可以使用 powershell.exe
程序的参数来自定义会话。 有关详细信息,请参阅 PowerShell.exe 命令行帮助。
使用管理权限(以管理员身份运行)
单击“开始”,键入 PowerShell,右键单击“Windows PowerShell”,然后单击“以管理员身份运行”。
如何在早期版本的 Windows 上启动 Windows PowerShell ISE
使用以下任一方法启动 Windows PowerShell ISE。
在“开始”菜单中
- 单击“开始”,键入 ISE,然后单击“Windows PowerShell ISE”。
- 在“开始”菜单中,依次单击“开始”、“所有程序”、“附件”、“Windows PowerShell”文件夹,然后单击“Windows PowerShell ISE”。
在命令提示符处
在 Windows Command shell、Windows PowerShell 或 Windows PowerShell ISE 中,若要启动 Windows PowerShell,请键入:PowerShell_ISE
。 在 Windows PowerShell 中,可以使用别名 ise
。
使用管理权限(以管理员身份运行)
单击“开始”,键入 ISE,右键单击“Windows PowerShell ISE”,然后单击“以管理员身份运行”。
如何在早期版本的 Windows 上启用 Windows PowerShell ISE
在 Windows PowerShell 4.0 和 Windows PowerShell 3.0 中,默认情况下,所有版本的 Windows 上都启用 Windows PowerShell ISE。 如果尚未启用,则 Windows Management Framework 4.0 或 Windows Management Framework 3.0 会启用它。
在 Windows PowerShell 2.0 中,默认情况下,在 Windows 7 上启用 Windows PowerShell ISE。 但是,在 Windows Server 2008 R2 和 Windows Server 2008 上,它是一项可选功能。
若要启用 Windows Server 2008 R2 或 Windows Server 2008 上的 Windows PowerShell 2.0 中的 Windows PowerShell ISE,请使用以下过程。
启用 Windows PowerShell 集成脚本环境 (ISE)
- 启动服务器管理器。
- 单击“功能”,然后单击“添加功能”。
- 在“选择功能”中,单击“Windows PowerShell 集成脚本环境 (ISE)”
启动 32 位版本的 Windows PowerShell
在 64 位计算机 (Windows PowerShell (x86) ) 上安装 Windows PowerShell 时,除 64 位版之外,还将安装 32 位版本的 Windows PowerShell。 运行 Windows PowerShell 时,默认运行 64 位版。
但是,有时可能需要运行 Windows PowerShell (x86),例如使用需要 32 位版本的模块时,或者远程连接到 32 位计算机时。
若要启动 32 位版本的 Windows PowerShell,请使用以下任何过程。
在 Windows Server 2012 R2 中
- 在“开始”屏幕上,键入 Windows PowerShell (x86)。 单击“Windows PowerShell x86”磁贴。
- 在“服务器管理器”中,从“工具”菜单中选择“Windows PowerShell (x86)”。
- 在桌面上,将光标移动到右上角,单击“搜索”,键入PowerShell x86,然后单击“Windows PowerShell (x86)”。
- 通过命令行,输入:
%SystemRoot%\SysWOW64\WindowsPowerShell\v1.0\powershell.exe
在 Windows 8.1 中
- 在“开始”屏幕上,键入 Windows PowerShell (x86)。 单击“Windows PowerShell x86”磁贴。
- 如果你正在运行 Windows 8.1 的远程服务器管理工具,则也可从“服务器管理器工具”菜单中打开 Windows PowerShell x86。 选择“Windows PowerShell (x86)”。
- 在桌面上,将光标移动到右上角,单击“搜索”,键入PowerShell x86,然后单击“Windows PowerShell (x86)”。
- 通过命令行,输入:
%SystemRoot%\SysWOW64\WindowsPowerShell\v1.0\powershell.exe