Start-Process starts a program or script as a separate process. Add -Wait to pause your script until it finishes, -ArgumentList to pass arguments and -PassThru to get a process object back, including the exit code:
$process = Start-Process -FilePath cmd.exe -ArgumentList '/c', 'exit 3' -Wait -PassThru -NoNewWindow
"Exit code: $($process.ExitCode)"
Output:
Exit code: 3

In this guide, I’ll cover the parameters you’ll use most, the argument-quoting trap, output redirection, running as administrator, and every way to make PowerShell wait for a command to finish.
I tested the examples in PowerShell 7.6 and Windows PowerShell 5.1, using console commands like cmd and ping so the results are easy to reproduce.
Start a program with Start-Process
At its simplest, give it a file path. PowerShell starts the program and immediately moves on:
Start-Process -FilePath notepad.exe
Start-Process -FilePath 'C:\Reports\Q3-sales.xlsx' # opens with the default app
Passing a document instead of an .exe opens it in whatever app is registered for that file type, just like double-clicking it.
| Parameter | What it does |
|---|---|
-FilePath | The program, script or document to start |
-ArgumentList | Arguments for the program, as one string or an array |
-Wait | Waits until the process (and its child processes) exit |
-PassThru | Returns a process object, for example to read ExitCode |
-NoNewWindow | Runs a console program in the current window |
-WindowStyle | Normal, Hidden, Minimized or Maximized |
-WorkingDirectory | The folder the process starts in |
-Verb RunAs | Starts the process elevated (as administrator) |
-Credential | Starts the process as another user |
Pass arguments with -ArgumentList
You can pass one string or an array. PowerShell joins the array with spaces into a single command line. That’s why a path with a space breaks:
Start-Process cmd.exe -ArgumentList '/c', 'type', 'C:\psfaqs\my notes.txt' -Wait -NoNewWindow
Output:
The system cannot find the file specified.
Error occurred while processing: C:\psfaqs\my.
The system cannot find the file specified.
Error occurred while processing: notes.txt.

cmd received C:\psfaqs\my and notes.txt as two separate files. Wrap the value in double quotes inside single quotes to keep it together:
Start-Process cmd.exe -ArgumentList '/c', 'type', '"C:\psfaqs\my notes.txt"' -Wait -NoNewWindow
Output:
Hello from a file with spaces
This is the single most common Start-Process bug I see. It behaves the same in PowerShell 7 and 5.1.
Capture the output of a process
Start-Process doesn’t return the program’s output. Send it to a file with -RedirectStandardOutput (and -RedirectStandardError for errors), then read the file:
Start-Process -FilePath cmd.exe -ArgumentList '/c', 'ver' -Wait -NoNewWindow `
-RedirectStandardOutput C:\psfaqs\ver.txt
(Get-Content C:\psfaqs\ver.txt | Where-Object { $_ }).Trim()
Output:
Microsoft Windows [Version 10.0.26200.9278]
If you only need the output, the call operator shown later is simpler, because it streams output straight into PowerShell.
How do I wait for a command to finish in PowerShell?
There are four options, depending on how the command was started.
1. Start-Process -Wait
Add -Wait when you start the process, as in the first example. PowerShell blocks until the process exits.
2. Wait-Process for a process that’s already running
Use -PassThru to keep the process object, do other work, and then wait for it:
$start = Get-Date
$ping = Start-Process ping.exe -ArgumentList '-n', '3', '127.0.0.1' -PassThru -WindowStyle Hidden
"Still running: $(-not $ping.HasExited)"
Wait-Process -Id $ping.Id
"Finished after {0:N0} seconds" -f ((Get-Date) - $start).TotalSeconds
Output:
Still running: True
Finished after 2 seconds

Add -Timeout so a hung process can’t block your script forever:
$ping = Start-Process ping.exe -ArgumentList '-n', '30', '127.0.0.1' -PassThru -WindowStyle Hidden
try {
Wait-Process -Id $ping.Id -Timeout 2 -ErrorAction Stop
}
catch {
"Gave up waiting: $($_.Exception.Message)"
Stop-Process -Id $ping.Id
}
Output:
Gave up waiting: This command stopped operation because process "PING (57568)" is not stopped in the specified time-out.
3. The call operator waits for console programs
When you run a console program directly (or with &), PowerShell waits for it and streams its output. $LASTEXITCODE holds the exit code:
cmd /c "echo Backing up files && exit 5"
"Exit code: $LASTEXITCODE"
Output:
Backing up files
Exit code: 5
4. Wait-Job for background jobs
For PowerShell code running in a background job, use Wait-Job and then collect the result with Receive-Job:
$job = Start-Job -ScriptBlock {
Start-Sleep -Seconds 2
"Report finished at $((Get-Date '2026-09-28 06:30').ToString('h:mm tt'))"
}
"Job state: $($job.State)"
Wait-Job -Job $job | Out-Null
Receive-Job -Job $job
Remove-Job -Job $job
Output:
Job state: Running
Report finished at 6:30 AM
Avoid Start-Sleep as a “wait”. A fixed delay is either too short on a slow day or wastes time on a fast one.
Run a process as administrator
-Verb RunAs starts the process elevated. Windows shows a UAC prompt unless your session is already elevated:
Start-Process -FilePath pwsh.exe -Verb RunAs -ArgumentList '-NoProfile', '-File', '"C:\Scripts\Update Servers.ps1"'
I didn’t run this one on my test PC, because it triggers a UAC prompt. Note that -Verb can’t be combined with -NoNewWindow or -Credential.
Run a process as a different user
Pass a credential object to start the process as another account:
$credential = Get-Credential 'CONTOSO\svc_reports'
Start-Process -FilePath pwsh.exe -Credential $credential -ArgumentList '-File', 'C:\Scripts\report.ps1'
See how to create a credential object in PowerShell and how to run PowerShell as a different user for more.
Microsoft lists every parameter in the Start-Process documentation.
Frequently Asked Questions
How do I make PowerShell wait for a process to finish?
Add -Wait to Start-Process, or keep the process with -PassThru and call Wait-Process -Id $process.Id later.
How do I get the exit code from Start-Process?
Use -Wait -PassThru and read $process.ExitCode. For programs run directly, check $LASTEXITCODE.
Why does Start-Process ignore my argument with a space?
The ArgumentList items are joined with spaces, so a path with a space becomes two arguments. Put double quotes around it, for example '"C:\my folder\file.txt"'.
How do I capture the output of Start-Process?
Use -RedirectStandardOutput and -RedirectStandardError to write the output to files, or run the command with the call operator to get the output directly.
How do I run Start-Process as administrator?
Add -Verb RunAs. Windows shows a UAC prompt if the current session isn’t already elevated.
You might also like:
- Kill a process by name in PowerShell
- Check if a process is running in PowerShell
- PowerShell Get-Process
- Run a PowerShell script with parameters
Bijay Kumar is an esteemed author and the mind behind PowerShellFAQs.com, where he shares his extensive knowledge and expertise in PowerShell, with a particular focus on SharePoint projects. Recognized for his contributions to the tech community, Bijay has been honored with the prestigious Microsoft MVP award. With over 15 years of experience in the software industry, he has a rich professional background, having worked with industry giants such as HP and TCS. His insights and guidance have made him a respected figure in the world of software development and administration. Read more.