This post will explain the procedure to run an “exe” file in PowerShell.
How to Run/Execute an exe File With Parameters With Spaces and Quotes in PowerShell?
These are the methods that can be used to execute the “exe” file”:
Method 1: Run an exe File With Parameters With Spaces and Quotes Using “Start-Process” Command in PowerShell
The first method to run the “exe” file is to use the “Start-Process” command in PowerShell. It is used to initiate one or more processes.
Example
Now, execute the provided command in PowerShell:
In this above-given command:
- First, we have utilized the “Start-Process” command to start a specific process.
- After that, specify the location of the “exe” file using the “-FilePath” parameter.
- “-Wait” parameter waits for a certain process before accepting a new input.
- “-WindowStyle” parameter with the value “Maximized” is used to maximize a certain process/application window:
As a result, the specified exe file will be executed.
Method 2: Run an exe File in PowerShell With Parameters With Spaces and Quotes Using Call Operator (&)
The “Call operator” (&) is also known as the invoke operator, as it is used to execute the program or a file from a specific directory.
Example
To utilize the Call operator for executing the selected exe file, run this command:
Here:
- First, we have added the invocation/call operator “&” to initialize the certain app/process.
- After that, mention the location of the exe file within the inverted commas.
- Then, we provided the audio file path to play on the “EXE” software.
- “/fullscreen” parameter is used to open the specified VLC executable file in full-screen mode:
When this code is executed, it will run the third-party video player and play the specified file in full-screen mode.
Conclusion
The “exe” file can be executed using two methods, including “Start-Process” and “Call Operator &”. In the first method, first, write the “Start-Process” cmdlet and then add the file path to run it. In the second method, first, write the call operator “&” and add the exe file path. Moreover, you can also add the parameters to run the executable file with additional functions. This post has provided several methods to run the “exe” file with parameters, spaces, and quotes.