PowerShell

Windows PowerShell 是以工作為基礎、專為系統管理而設計的命令列殼層和指令碼語言。 Windows PowerShell 是以 .NET Framework 為基礎所建置,可協助 IT 專業人員與進階使用者控制和自動化管理 Windows 作業系統與在 Windows 上執行的應用程式。

使用 PowerShell.exe

PowerShell.exe 命令列工具會在命令提示字元視窗中啟動 Windows PowerShell 工作階段。 當您使用 PowerShell.exe 時,可以使用其選擇性參數來自訂工作階段。 例如,您可以啟動使用特定執行原則的工作階段,或是排除 Windows PowerShell 設定檔的工作階段。 否則,工作階段會與 Windows PowerShell 主控台中啟動的任何工作階段相同。

  • 若要在命令提示字元視窗中啟動 Windows PowerShell 工作階段,請輸入 PowerShellPS 前置詞會新增至命令提示字元,以指出您是在 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。 隨即恢復一般命令提示字元。

備註