Command

There are several ways to run external commands in PowerShell

Run from the current directory

To run a file in the current directory, run it with .\.

# .\Program.exe arguments
PS C:\Program Files\Internet Explorer> .\iexplore.exe

# Can be done with slash.
# PowerShell does not distinguish between backslashes and slashes, so you can use
PS C:\Program Files\Internet Explorer> ./iexplore.exe

If the path is available

When the path is passed, you can omit .\.
The extension can also be omitted.

PS> notepad
PS> notepad.exe

If a path has spaces

Execute with the form & 'blank path'.

# & 'C:\Program Files\Program\Program.exe' arguments
PS> & 'C:\Program Files\Internet Explorer\iexplore.exe'

In PowerShell, if you enclose a variable in double quotes, the variable inside will be evaluated as an expression.
Therefore, in order to execute the command as intended, enclose it in single quotes.

YouTube

Click here for a video explanation.

Last modified October 11, 2022: update (8216439)