PowerShell is a powerful Windows built-in command-line shell and scripting environment tool. It’s widely used by people to deal with various works such as PowerShell copy files, PowerShell gets folder size, installing SSH PowerShell, PowerShell unzip/zip files, etc.
However, a lot of users and even professionals don’t know how to perform these operations in PowerShell. This post mainly focuses on PowerShell run exe. Let’s keep reading to know more details.
What Command Can Be Used to Run Exe from PowerShell
What command can be used to run exe in PowerShell Windows 10/11? After investigating extensive references, we found there are 2 main cmdlets – PowerShell Start-Process and Invoke-Expression to execute/run a .exe file.
With the PowerShell Start-Process cmdlet, you can enter a .exe file or script file that can be opened using a program on the local computer. The PowerShell Invoke-Expression cmdlet can run a .exe file or open a document file in the program associated with the document file type.
How to Run Exe from PowerShell Windows 10/11
How to let PowerShell execute exe on Windows 10/11? There are 3 simple ways that you can choose one according to your preference.
To execute exe from PowerShell smoothly, here we assume that the .exe file is located in the C:UsersAdministratorDownloads directory and the file name is partitionwizard.exe.
Make sure you replace the file directory/path and .exe file name according to your actual situation.
# 1. PowerShell Run Exe Directly
If you want to install exe with PowerShell directly, you can use the “.” parameter before the .exe file name. Here’s how to do that:
Step 1. Press the Win + R keys to open the Run box, and then type powershell in it and press Ctrl + Shift + Enter keys to open the elevated PowerShell window.
Step 2. In the pop-up window, type the following command and hit Enter to locate the directory where the partitionwizard.exe file is located.
cd C:UsersAdministratorDownloads
Step 3. Now, you should locate the Downloads folder. Run the following command and check if partitionwizard.exe exists in the directory.
Get-ChildItem
Step 4. Type “.” before the partitionwizard.exe file to run exe from PowerShell script. Once done, the installer of partitionwizard.exe should start installing on the computer.
.partitionwizard.exe
# 2. PowerShell Run Exe via the Start-Process Cmdlet
Another command method for the PowerShell execute exe operation is to use the Start-Process cmdlet. To do this work, follow the detailed steps below:
Step 1. Open the elevated PowerShell window again as we explain above.
Step 2. Type the following command and hit Enter to locate the directory where the partitionwizard.exe file is stored. Then it should open the exe file and execute.
Start-Process -FilePath ‘C:UsersAdministratorDownloadspartitionwizard.exe’
Step 3. Alternatively, you can run the following commands one by one to execute the partitionwizard.exe file.
- cd C:UsersAdministratorDownloads
- Start-Process partitionwizard.exe
# 3. PowerShell Run Exe via the Invoke-Expression Cmdlet
In addition to the above 2 methods, you can install exe with PowerShell Invoke-Expression cmdlet on Windows 10/11. It’s very simple to operate. To do so, open the elevated PowerShell window, type the following command, and hit Enter to execute the partitionwizard.exe file.
Invoke-Expression -Command ‘C:UsersAdministratorDownloadspartitionwizard.exe’
Or
‘C:UsersAdministratorDownloadspartitionwizard.exe’ | Invoke-Expression
Further reading: If you enter some issues like file system corruption and low disk space on Windows 10/11, don’t worry. MiniTool Partition Wizard can help you fix them easily by checking file system errors, extending/resizing partitions, analyzing disk space, upgrading to a larger hard disk, etc.