- You can execute executable files (EXE) using the .\ prefix, the & operator, the Invoke-Expression cmdlet, the CMD /C command, and the Start-Process cmdlet.
- When running EXEs from PowerShell, you must know potential security risks and implement appropriate measures to protect your system from malicious code.
Method 1: Using .\ (Dot Slash)
To run an executable file (EXE) located in your PowerShell working directory, use the .\ (dot slash) prefix. This tells PowerShell to execute the file from the present folder rather than searching for it within the directories in your system’s PATH environment variable.
Step 1: Press Windows + S on your keyboard, type PowerShell , and click Run as Administrator . Select Yes when prompted.

Step 2: Navigate to the EXE location. Use the cd command to go to the folder containing your EXE file. For instance:
cd C:\Programs\MyProgramFolder

Step 3: Now, run the EXE. Type .\ followed by the name of the EXE file and press Enter . Example:
.\myprogram.exe

Step 4: If facing problems locating EXE files, use the Get-ChildItem command. Here’s how to use it:
Get-ChildItem *.exe

Method 2: Using Call Operator (&)
The call operator (&) offers a straightforward way to execute EXE files directly from the PowerShell prompt. This method is ideal for quick and simple execution and doesn’t require complex control over the launch process.
Step 1: Launch the Run box by pressing Windows + R on your keyboard. Type PowerShell in the search box and click OK .

Step 2: To run PowerShell as an administrator, type the command below and hit Enter . Additionally, click Yes when prompted.
Start-Process powershell -Verb runAs

Step 4: In the new Administrator PowerShell window, type & operator followed by the full path to the EXE file and hit Enter .
& 'C:\Program Files\MyProgram\MyProgram.exe'

Step 5: If your EXE file requires command-line arguments, add them after the file path. Here’s how to do so:
& 'C:\Program Files\ExampleSoftware\program.exe' arg1 arg2 arg3

Note: The argument /p in the image below will print the EXE file whose path has been specified later.
Method 3: Via the Invoke-Expression Cmdlet
The Invoke-Expression cmdlet in PowerShell offers a way to execute strings dynamically as if they were direct commands. This enables you to run EXE files by providing the full path to the executable. This method can save your life when you need to build the command string for the executable at runtime.
Step 1: Click the Windows icon, type PowerShell in the search box, and select Run as Administrator . When a pop-up appears, choose Yes .

Step 2: Write the command below to run an EXE file and hit Enter on your keyboard.
Invoke-Expression -Command "C:\path to\filename.exe"

Step 3: If you want to add arguments while launching the EXE file, enter the below arguments and press Enter .
Invoke-Expression "C:\path\to\your\file.exe arg1 arg2 arg3"

If you’re dealing with a complicated script involving different paths and arguments, create a variable for these paths and arguments. Later, you can use this variable to simplify the process. Follow the steps below to do so:
Step 1: Set the exe path by typing the below commands and hitting Enter .
$exePath = "C:\myapp.exe"

Step 2: Write the commands below and press Enter to run an executable (EXE) with arguments.
$arguments = "-arg1 -arg2"

Step 3: Lastly, write the code below to run an executable file and hit Enter .
Invoke-Expression "$exePath $arguments"

Method 4: Using CMD /C
PowerShell’s CMD /C command essentially creates a temporary instance of the classic Command Prompt (cmd.exe) to execute a specified command. Here’s how to do so:
Step 1: Click the Start button, write PowerShell , and click Run as Administrator. Select Yes to allow the app to make changes to your device.

Step 2: Type the command below to make a cmd instance in your PowerShell window and hit Enter .
cmd /c "path_to_your_exe_file"

Step 3: To run arguments, type the code below and press the Enter key.
cmd /c "path_to_your_exe argument1 argument2"

Method 5: Using Start-Process Cmdlet
The Start-Process cmdlet offers significant control over the execution process. You should use it to specify command-line arguments, adjust the working directory, redirect output, or launch a process with elevated permissions (administrator rights) using certain parameters.
Step 1: Press Windows + S on your keyboard, write PowerShell , and click Run as Administrator . In the pop-up window, select Yes .

Step 2: Write the command below and hit Enter to open an EXE app using Start-Process.
Start-Process name.exe

Step 3: To open a specific EXE file, type the following command and press Enter on your keyboard.
Start-Process -FilePath "filepath.exe"

Step 4: You can also run arguments while passing the parameters. Write the below command to do so and hit Enter .
Start-Process -FilePath "filename.exe" -argumentList "path_of_the_exe_file"

Here are some of the most useful parameters for customizing how Start-Process works:
- -FilePath: Specifies the path to the executable, script, or document.
- -ArgumentList: Provides a list of arguments to pass to the process.
- -WorkingDirectory: Sets the initial working directory for the process.
- -Verb: Specifies the action to perform on the file (like “open”, “edit”, “print”). Use Get-Verb to see available verbs.
- -WindowStyle: Determines the window’s initial style (Normal, Hidden, Minimized, Maximized).
- -Wait: Causes PowerShell to wait for the process to exit before continuing.
- -PassThru: Returns a process object, providing details and control over the started process.
- Are there any security risks involved in running EXEs from PowerShell?
Yes, running EXEs from PowerShell carries significant security risks. The EXE could be malicious, grant attackers unauthorized access, run harmful code, or steal data.
- How can I handle errors if the EXE execution fails?
Use PowerShell’s try…catch blocks to capture potential errors during EXE execution. This allows you to log the failure or take corrective actions.