Starts Windows PowerShell from the command line of another tool, such as Cmd.exe.


	 [-PSConsoleFile <file> | -Version <version>]
	 [-EncodedCommand <Base64EncodedCommand>]
	 [-ExecutionPolicy <ExecutionPolicy>]
	 [-File <filePath> <args>]
	 [-InputFormat {Text | XML}] 
	 [-OutputFormat {Text | XML}] 
	 [-WindowStyle <style>]
	 [-Command { - | <script-block> [-args <arg-array>]
					 | <string> [<CommandParameters>] } ]

PowerShell[.exe] -Help | -? | /?



Accepts a base-64-encoded string version of a command. Use this parameter to submit commands to Windows PowerShell that require complex quotation marks or curly braces.


Sets the default execution policy for the session. This parameter does not change the Windows PowerShell execution policy that is set in the registry.


Runs the specified script. Enter the script file path and any parameters.


Describes the format of data sent to Windows PowerShell. Valid values are "Text" (text strings) or "XML" (serialized CLIXML format).


Does not exit after running startup commands.


Hides the copyright banner at startup.


Does not present an interactive prompt to the user.


Does not load the Windows PowerShell profile.


Determines how output from Windows PowerShell is formatted. Valid values are "Text" (text strings) or "XML" (serialized CLIXML format).


Loads the specified Windows PowerShell console file. To create a console file, use the Export-Console cmdlet in Windows PowerShell.


Starts the shell using a single-threaded apartment.


Starts the specified version of Windows PowerShell. Enter a version number with the parameter, such as "-version 1.0".


Sets the window style to Normal, Minimized, Maximized or Hidden.


Executes the specified commands (and any parameters) as though they were typed at the Windows PowerShell command prompt, and then exits, unless NoExit is specified. The value of Command can be "-", a string. or a script block.

If the value of Command is "-", the command text is read from standard input.

Script blocks must be enclosed in braces ({}). You can specify a script block only when running PowerShell.exe in Windows PowerShell. The results of the script are returned to the parent shell as deserialized XML objects, not live objects.

If the value of Command is a string, Command must be the last parameter in the command , because any characters typed after the command are interpreted as the command arguments.

To write a string that runs a Windows PowerShell command, use the format:

"& {<command>}"

where the quotation marks indicate a string and the invoke operator (&) causes the command to be executed.

-Help, -?, /?

Shows this message. If you are typing a PowerShell.exe command in Windows PowerShell, prepend the command parameters with a hyphen (-), not a forward slash (/). You can use either a hyphen or forward slash in Cmd.exe.


PowerShell -PSConsoleFile sqlsnapin.psc1

PowerShell -version 1.0 -NoLogo -InputFormat text -OutputFormat XML

PowerShell -Command {Get-EventLog -LogName security}

PowerShell -Command "& {Get-EventLog -LogName security}"

# To use the -EncodedCommand parameter:
$command = "dir 'c:\program files' "
$bytes = [System.Text.Encoding]::Unicode.GetBytes($command)
$encodedCommand = [Convert]::ToBase64String($bytes)
powershell.exe -encodedCommand $encodedCommand