PowerShell is a command-line tool to automate various tasks such as creating, opening, or modifying files. It comes with built-in support for Microsoft Windows. Moreover, you can install it on various Linux distributions and macOS. PowerShell also supports scripting language to perform programming-related tasks. It operates four different commands: cmdlets, executable programs, PowerShell Functions, and PowerShell Scripts. You can check the list of all four types of commands by using “Get-Command” in your PowerShell. Among all these commands, cmdlets are the most used command.

PowerShell supports a variety of files to be executed using commands. Executable (.exe) files are one of them. The .exe files start operating once they are opened. These .exe files can be created via various methods such as C or C language and Python. The operating system does not bother how or why this file was created. It just acts to run the file. Once the .exe file is created, you do not have to perform any coding or extra tasks. You must follow the instructions.

Moreover, the .exe files can contain any content inside, but the condition is that it must be executed once it is opened. The variety of PowerShell cmdlets provide support to open the .exe files.

In this article, we will refer to numerous methods to run a .exe file with the help of Windows PowerShell:

How to Run .exe Files Using PowerShell

There are various ways to run an .exe file using the PowerShell terminal.

At first, open your PowerShell terminal. Click on the Search icon on the start menu and search for PowerShell. Once you find your search result, click on PowerShell. Open it to start writing:

<img data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/08/echo/word-image-529.png" data-lazy- height="671" src="data:image/svg xml,” width=”344″>

Method 1

Open your PowerShell terminal. Once it is opened, trace the location of the .exe file. In my case, the .exe file is stored in directory “C:usersadnandownloads“, and the file’s name is “Batmon.exe“. So, you have to move your terminal to the targeted directory. You have to use the “cd” command to change the directory:

<img data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/08/echo/word-image-530.png" data-lazy- height="70" src="data:image/svg xml,” width=”660″>

As you can check, the present working directory has been changed to downloads. You can execute the following command to check the file resides in the folder or not:

<img data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/08/echo/word-image-531.png" data-lazy- height="305" src="data:image/svg xml,” width=”806″>

“Batmon.exe” exists in the directory;

So, the next command which will open the file is given below:

It is mandatory to write “.” before the .exe file name. Otherwise, the command will not run. The installer of “Batmon.exe” will start operating after the successful execution of the command:

<img data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/08/echo/word-image-532.png" data-lazy- height="497" src="data:image/svg xml,” width=”741″>

Furthermore, you can perform this method using PowerShell ISE. It is observed that PowerShell ISE provides the dropdown list of the files available in the targeted directory. In “Method 1“, the target directory is “C:usersadnandownloads“, so navigate your terminal to this directory. When you type “.”, it will open a drop-down list of available files, as shown below:

<img data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/08/echo/word-image-533.png" data-lazy- height="266" src="data:image/svg xml,” width=”602″>

Moreover, if you type the name of the .exe file, the filename will be displayed in the dropdown list, and when you can press enter to execute the .exe file:

<img data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/08/echo/word-image-534.png" data-lazy- height="457" src="data:image/svg xml,” width=”558″>

Method 2

This method uses the Start-Process cmdlet. The stated cmdlet PowerShell with the “-FilePath” option takes the complete path of the .exe file. Moreover, “-ArgumentList” specifies the parameters when the process starts in PowerShell. Whereas “-PassThru” is used to verify that the cmdlet worked as you intended.

For instance, I want to open “filelister.exe“, which resides in the directory: C:usersadnandownloadsfilelister.exe.

Copy the path of the .exe file and paste in the command given below:

> StartProcess -Wait -FilePath ‘C:usersadnandownloadsfilelister.exe’ -ArgumentList/s’ -PassThru

When you enter the command, it will open the requested .exe file and operate:

<img data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/08/echo/word-image-535.png" data-lazy- height="590" src="data:image/svg xml,” width=”1347″>

Another way to execute the .exe file is by using the same cmdlet Start-Process. However, this time, we will navigate the terminal to the directory of the .exe file. For example, we want to open the “filelister.exe” that is placed in “C:usersadnandownloads“. Change the directory to downloads using the following command:

<img data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/08/echo/word-image-536.png" data-lazy- height="55" src="data:image/svg xml,” width=”739″>

After moving to the location, you have to execute the following command to run “filelister.exe“:

> StartProcess filelister.exe

<img data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/08/echo/word-image-537.png" data-lazy- height="517" src="data:image/svg xml,” width=”783″>

You can also perform method 2 using PowerShell ISE. PowerShell ISE is more user-friendly because it shows the complete cmdlet list starting with the first word you type.

Open PowerShell ISE and navigate to the .exe file location. Execute the Start-Process cmdlet as given below:

> StartProcess filelister.exe

<img data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/08/echo/word-image-538.png" data-lazy- height="573" src="data:image/svg xml,” width=”732″>

The command and the output in both cases are the same. However, one output is generated from PowerShell, and the other output is generated from PowerShell ISE

Conclusion:

PowerShell automates various tasks of the Windows operating system. It can execute a variety of files; executable files or .exe are one of them. This guide will help you learn something new about PowerShell. In this post, we have demonstrated several methods to run an .exe file from Windows PowerShell. The built-in Start-Process cmdlet of PowerShell is the most used to open .exe files.