Windows PowerShell 是基于任务的命令行 shell 和脚本语言,专为系统管理而设计。 Windows PowerShell 基于 .NET Framework 构建,可帮助 IT 专业人员和电源用户控制并自动管理在 Windows 上运行的 Windows作系统和应用程序。
使用 PowerShell.exe
PowerShell.exe 命令行工具在命令提示符窗口中启动 Windows PowerShell 会话。 使用 PowerShell.exe时,可以使用其可选参数自定义会话。 例如,可以启动使用特定执行策略的会话或排除 Windows PowerShell 配置文件的会话。 否则,会话与在 Windows PowerShell 控制台中启动的任何会话相同。
若要在命令提示符窗口中启动 Windows PowerShell 会话,请键入
PowerShell
。 PS 前缀将添加到命令提示符中,以指示你在 Windows PowerShell 会话中。若要使用特定执行策略启动会话,请使用 ExecutionPolicy 参数,然后键入:
PowerShell.exe -ExecutionPolicy Restricted
若要在没有 Windows PowerShell 配置文件的情况下启动 Windows PowerShell 会话,请使用 NoProfile 参数,然后键入:
PowerShell.exe -NoProfile
若要启动会话,请使用 ExecutionPolicy 参数,然后键入:
PowerShell.exe -ExecutionPolicy Restricted
若要查看 PowerShell.exe 帮助文件,请键入:
PowerShell.exe -help PowerShell.exe -? PowerShell.exe /?
若要在命令提示符窗口中结束 Windows PowerShell 会话,请键入
exit
。 典型的命令提示符返回。
注解
有关 PowerShell.exe 命令行参数的完整列表,请参阅 about_PowerShell.Exe。
有关启动 Windows PowerShell 的其他方法的信息,请参阅 启动 Windows PowerShell。
Windows PowerShell 在 Windows Server作系统的服务器核心安装选项上运行。 但是,需要图形用户界面的功能(如 Windows PowerShell 集成脚本环境(ISE),以及 Out-GridView 和 Show-Command cmdlet 等功能不会在 Server Core 安装上运行。