Download Article
Open and run .exe files with PowerShell for Windows
Download Article
If you need to launch an executable file from PowerShell, you have several options. If you're in the same directory as the EXE file, type .\ before its filename (e.g., .\notepad.exe ) and press Enter. You can run the EXE from a different directory using the PowerShell call operator (&), the Start-Process cmdlet, or the Invoke-Expression cmdlet. Each PowerShell run option is easy and can be used at the command line and in your PowerShell scripts.
Things You Should Know
- Use .\filename.exe to run an EXE from the current directory in PowerShell.
- To run an EXE from another directory, you can use & "C:\Windows\notepad.exe"
- To use the Start-Process cmdlet to run the program, type Start-Process -FilePath "filename.exe"
Steps
Section 1 of 4:
Using .\ (Dot Slash)
-
Use cd to enter the directory that contains the EXE file. For example, if you want to run notepad.exe from PowerShell , type cd "C:\Windows\" and press Enter .
-
Enter the command to run the EXE file. To run an EXE file from the current directory in PowerShell, you'll need to preface the filename with .\ . For example, to run notepad.exe, type .\notepad.exe and press Enter .
- Typing the .\ before the filename tells PowerShell you want to run the EXE file from the current directory.
- If you want to run the EXE file from a different directory, use the call operator (&) .
Advertisement -
Use Get-ChildItem to locate EXE filenames (if needed). If you get an error that says, "The term (EXE file name) is not recognized as a name of a cmdlet, function, script file, or executable program," you're either entering the wrong file name or in the wrong directory. Get-ChildItem shows you all files and permissions in the current directory.
- To show only EXE files, use Get-ChildItem *.exe . [1] X Research source
- You can also use Get-ChildItem to list files in other directories. For example, to show all executable files in C:\Program Files\Ableton\Live 11 Lite\Program, you'd use "C:\Program Files\Ableton\Live 11 Lite\Program\*.exe" .
Advertisement
Expert Q&A
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
Advertisement
Tips
Submit a Tip
All tip submissions are carefully reviewed before being published
Name
Please provide your name and last initial
Thanks for submitting a tip for review!
References
- ↑ https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-childitem?view=powershell-7.3
- ↑ https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_operators?view=powershell-7.3
- ↑ https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/start-process?view=powershell-7.3
- ↑ https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-expression?view=powershell-7.3
About This Article
Thanks to all authors for creating a page that has been read 89,314 times.
Advertisement