Introduction PowerShell Start-Process
Here are neat examples of how Start-Process can be used to launch executables and other files.
Topics for PowerShell Start-Process Cmdlet
- Example 1: Launch a Program Such as Notepad
- Example 2: Launch Internet Explorer
- Help with Start-Process
- Invoke-Item An Alternative to Start-Process
- Summary of PowerShell Get-Process
♣
Example 1: Launch a Program Such as Notepad
Let us begin by executing a built-in Windows program such as Notepad. Start-Process requires V 2.0 or later, I used the PowerShell_ISE (GUI) in Windows 8, but the commands work just as well in plain PowerShell (command-line) in Windows 7.
# PowerShell Launch Notepad
Start-Process Notepad
Note 1: The program in this example is in the system’s path, namely
C:\WINDOWS\system32\notepad.exe
Example 2: Launch Internet Explorer
The problem in the second example is that the executable, iexplore, is not in the path. Fortunately, the solution is straightforward, namely define the path to the program files.
# PowerShell Launch Internet Explorer
$Browser = "C:\Program Files (x86)\Internet Explorer\IEXPLORE.EXE"
$Browser64 = "C:\Program Files\Internet Explorer\iexplore.exe"
Start-Process $Browser
Note 2: In 64-bit operating systems there are two versions of Internet Explorer.
Note 3: Check your path with this PowerShell variable
$env:Path
Guy Recommends: A Free Trial of the Network Performance Monitor (NPM) v11.5
SolarWinds’ Network Performance Monitor will help you discover what’s happening on your network. This utility will also guide you through troubleshooting; the dashboard will indicate whether the root cause is a broken link, faulty equipment or resource overload.
What I like best is the way NPM suggests solutions to network problems. Its also has the ability to monitor the health of individual VMware virtual machines. If you are interested in troubleshooting, and creating network maps, then I recommend that you try NPM now.
Download a free trial of Solarwinds’ Network Performance Monitor
Help with Start-Process
PowerShell’s own Get-Help command reveals interesting parameters that can refine the process, for example start Maximized.
# Help for PowerShell’s Start-Process
Clear-Host
Get-Help Get-Process
Note 4: The parameter -WindowStyle allows you to maximize or minimize the application. Whereas, -WorkingDirectory is an alternative to specifiying the full path. I discovered that -FilePath is only useful for examples where you call for document type and need the underlying program.
# PowerShell Start-Process Research
$Path = "C:\Program Files\Internet Explorer"
Start-Process -WorkingDirectory $Path iexplore.exe -WindowStyle Maximized
Invoke-Item An Alternative to Start-Process
Both Invoke-Item and Start-Process emulate the ond trick of WinKey +r –> ‘name of executable’.
# Here is an alternative to PowerShell’s Start-Process.
Clear-Host
Invoke-Item "C:\Program Files\Internet Explorer\iexplore.exe"
Note 5: Once again, I find that we need to specify the full path to the Internet Explorer.
Start-Process -ArgumentList
This is most useful for parameter for modifying the behavior of the underling program you wish to execute.
Guy Recommends: SolarWinds Engineer’s Toolset v10
This Engineer’s Toolset v10 provides a comprehensive console of 50 utilities for troubleshooting computer problems. Guy says it helps me monitor what’s occurring on the network, and each tool teaches me more about how the underlying system operates.
There are so many good gadgets; it’s like having free rein of a sweetshop. Thankfully the utilities are displayed logically: monitoring, network discovery, diagnostic, and Cisco tools. Try the SolarWinds Engineer’s Toolset now!
Download your fully functional trial copy of the Engineer’s Toolset v10
List More Members of the Process Family
With a noun such as -Process you may suspect that there other members of this family such as Get-Process and Stop-Process, this is how you can find the full list:
# Research PowerShell nouns
Get-Command -noun process
Name
—-
Debug-Process
Get-Process
Start-Process
Stop-Process
Wait-Process
Start-Process Aliases
I am not a great fan of PowerShell aliases, however it’s worth knowing that Start is an alias for Start-Process. Incidentally, there is a lesser known alias SAPS.
Summary of PowerShell’s Start-Process
Start-Process provides a sound way to launch executables from a script, or from the PowerShell interface.
If you like this page then please share it with your friends
See more PowerShell examples of process and service
• PowerShell Home • Get-Process • Stop-Process • PowerShell Start-Process • Set-Service
• Get-Service • Start-Service • Stop-Service • Restart-Service • Free WMI Monitor
• PowerShell Start-Sleep • Get-WmiObject win32_service • Windows PowerShell
Please email me if you have a better example script. Also please report any factual mistakes, grammatical errors or broken links, I will be happy to correct the fault.