Start-Process
Open a file or start a program
Start-Process -FilePath .\notes.txt
- Works on
- WindowsLinuxmacOS
- PowerShell
- 5.1 and later
- Reference
- Microsoft Learn: Start-Process
- PowerShell 7 On Linux and macOS, the start alias is not defined. Type Start-Process.
Starts a program in its own window. Point it at a document or a URL and it opens with the default app, like double-clicking.
Common parameters
-ArgumentListpasses arguments to the program.-Waitwaits until the program closes before PowerShell continues.-Verb RunAsasks Windows to run it as administrator (you get the UAC prompt).-PassThrureturns the process, so you can check.ExitCodelater.
Try this
Start-Process -FilePath notepad.exe -ArgumentList .\notes.txt
Start-Process -FilePath .\report.pdf
Start-Process -FilePath 'https://learn.microsoft.com/powershell/'
Start-Process -FilePath powershell.exe -Verb RunAs
Coming from another shell
| Shell | What you might type |
|---|---|
| bash / zsh | xdg-open notes.txt |
| cmd.exe | start notes.txt |
More in From bash and From cmd.