可以从“开始”菜单、任务栏、“搜索”或“运行”框、命令提示符窗口中启动 Windows PowerShell,甚至可以从另一个 Windows PowerShell 窗口中启动它。
可以在一台计算机上启动 Windows PowerShell(或 Windows PowerShell ISE)的多个实例。
如何启动 Windows PowerShell
在 Windows Vista、Windows Server 2008 和更高版本的 Windows 上,若要从“开始”菜单中启动 Windows PowerShell,请依次单击“开始”、“所有程序”、“附件”、“Windows PowerShell”文件夹和“Windows PowerShell”项。
在 Windows XP 和 Windows Server 2003 上,若要从“开始”菜单中启动 Windows PowerShell,请依次单击“开始”、“程序”、“附件”、“Windows PowerShell”文件夹和“Windows PowerShell”项。
如何启动 Windows PowerShell ISE
Windows PowerShell 集成脚本环境 (ISE) 是一种新的主机应用程序,允许您在友好的、语法着色的环境中运行命令并编写、测试和调试脚本。
在 Windows Vista、Windows Server 2008 和更高版本的 Windows 中,若要从“开始”菜单中启动 Windows PowerShell ISE,请依次单击“开始”、“所有程序”、“附件”、“Windows PowerShell”文件夹和“Windows PowerShell ISE”项。
在 Windows XP 和 Windows Server 2003 中,若要从“开始”菜单中启动 Windows PowerShell,请依次单击“开始”、“程序”、“附件”、“Windows PowerShell”文件夹和“Windows PowerShell ISE”项。
如何启动带所有模块的 Windows PowerShell
在 Windows 7 和 Windows Server 2008 R2 中,您可以使用任务启动一个 Windows PowerShell 窗口,该窗口中包含可选模块和管理单元中为您提供的所有命令,其中包括默认情况下未以其他方式添加的命令。该窗口还具有 Administrator 帐户的特权。
有关 Windows PowerShell 模块和管理单元的详细信息,请参阅使用模块和管理单元、如何导入模块和 about_Modules。
若要启动带所有模块的 Windows PowerShell,请使用以下任一过程。
- 在任务栏中,右键单击“Windows PowerShell”图标,然后单击“导入所有模块”。
依次单击“开始”、“管理工具”和“Windows PowerShell 模块”。
注意: | |
在 Windows Server 2008 R2 中,Windows PowerShell 图标默认固定在任务栏中。不过,必须启动一次 Windows PowerShell 才能使“导入所有模块”任务出现。 |
在所有受支持的 Windows 版本中,可以向 Windows PowerShell 会话中添加所有可用的模块。启动 Windows PowerShell 并在 Windows PowerShell 提示符处键入:
get-module -listAvailable | import-module
如何用管理员特权启动 Windows PowerShell
在 Windows 7 和 Windows Server 2008 R2 中,可以使用任务并以 Administrator 帐户的全部特权启动 Windows PowerShell 窗口。通常没有必要这样做,但有少数几个命令需要这些特权。
在 Windows 任务栏中,右键单击“Windows PowerShell”图标,然后单击“以 admin 身份运行 Windows PowerShell”。
若要在所有受支持的 Windows 版本中用管理员特权启动 Windows PowerShell(或 Windows PowerShell ISE),请使用以下过程。
- 依次单击“开始”、“程序”、“附件”和“Windows PowerShell”文件夹。
- 右键单击“Windows PowerShell”项(或“Windows PowerShell ISE”项),然后单击“以管理员身份运行”。
如何用其他选项启动 Windows PowerShell
Windows PowerShell 有很多允许您启动自定义 Windows PowerShell 会话的选项,其中包括使用特定控制台文件的选项、以特定执行策略运行的选项、排除您的 Windows PowerShell 配置文件的选项、运行特定的命令或脚本的选项或者使用单线程单元的选项等等。
若要查看这些选项,请在命令提示符 (Cmd.exe) 窗口或现有的 Windows PowerShell 窗口中键入:
powershell -?
若要用特定选项启动 Windows PowerShell,请使用该选项的参数。例如,若要用 RemoteSigned 执行策略启动 Windows PowerShell,请键入:
powershell -executionPolicy RemoteSigned