Windows PowerShell 是以工作為基礎的命令行殼層和腳本語言,專為系統管理所設計。 以 .NET Framework 為基礎,Windows PowerShell 可協助 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作系統的 Server Core 安裝選項上執行。 不過,需要圖形使用者介面的功能,例如 Windows PowerShell 整合式腳本環境 (ISE),以及 Out-GridView 和 Show-Command Cmdlet,則不會在 Server Core 安裝上執行。