PowerShell.exe Command-Line
suggest changeParameters
These switches are the powershell.exe (Windows PowerShell) set. pwsh.exe shares many of them. On pwsh, -Version prints the version and ignores other arguments; it does not select Windows PowerShell 2.0. -PSConsoleFile is Windows PowerShell only. -Mta and -Sta apply to the Windows host. A -Command script block works when the caller is already PowerShell. From cmd.exe, pass a string.
| Parameter | Description |
|---|---|
-Help, -?, /? |
Shows the help |
-File <FilePath> [<Args>] |
Path to the script file to execute, and optional arguments |
-Command |
Commands to execute, followed by arguments. The argument is -, a script block with optional -args, or a string |
-EncodedCommand <Base64EncodedCommand> |
Base64-encoded commands |
-ExecutionPolicy <ExecutionPolicy> |
Sets the execution policy for this process only |
-InputFormat { Text | XML } |
Sets the input format for data sent to the process. Text (strings) or XML (serialized CLIXML) |
-Mta |
PowerShell 3.0 and later: runs in a multithreaded apartment. STA is the default |
-Sta |
Windows PowerShell 2.0: runs in a single-threaded apartment. MTA is the default in 2.0 |
-NoExit |
Leaves the PowerShell console running after the script or command |
-NoLogo |
Hides the copyright banner at launch |
-NonInteractive |
Does not prompt the user. It does not hide the window; use -WindowStyle Hidden for that |
-NoProfile |
Does not load machine or user profiles |
-OutputFormat { Text | XML } |
Sets the output format for data returned from PowerShell. Text (strings) or XML (serialized CLIXML) |
-PSConsoleFile <FilePath> |
Loads a console file that configures the environment (created with Export-Console) |
-Version <Windows PowerShell version> |
Runs a specific Windows PowerShell version. Mostly used with 2.0 |
-WindowStyle <style> |
Starts the window as Normal, Hidden, Minimized, or Maximized |
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents