How to Open Application Using PowerShell
Introduction
With PowerShell, we are able to open an application with a single command. In this article, we’ll walk through how to use PowerShell commands to open applications.
Solution
Using Start-Process
Once you are in PowerShell environment, you can type in Start-Process
followed by the path of your application executable file.
For example, if you wanted to open Visual Studio 2022 where the executable file is physically located at C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\devenv.exe
, you would type following script into PowerShell.
Start-Process 'C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\devenv.exe'
The Start-Process
command will launch any application. Simply type in the name of the program that you want to open, and it should launch almost immediately.
Using Invoke-Item
Another useful command is Invoke-Item
which can also be used to open specific item from within PowerShell. To use this command, simply enter it followed by the path of the item you want to open, for example Visual Studio 2022 as in previous method.
Invoke-Item 'C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\devenv.exe'
This will automatically launch whichever program is associated with that particular item.
Using Call Operator (&)
Call Operator &
can also be used to open an application. The pattern is the same with previous example where the operator must be followed by the path to executable file. In this case, we open Visual Studio 2022 IDE.
& 'C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\devenv.exe'
Conclusion
Using Windows PowerShell commands makes opening applications incredibly easy and efficient, just remember we can use Start-Process
, Invoke-Item
or Call Operator &
before specifying which application you wish to open.