start-process — Launch a detached or elevated process across all 5 shells
Equivalents in every shell
long-task &The `&` operator runs the preceding command asynchronously and returns control immediately. Closing the terminal sends SIGHUP and kills the job. `nohup long-task &` keeps the job alive after logout; `disown %1` detaches an existing job. For full daemonisation, use `systemd-run --user` or `setsid long-task </dev/null >/dev/null 2>&1 &`.
long-task &Same `&` operator. Zsh adds `&!` (background AND immediately disown) — equivalent to `bash -c "long-task & disown"` in one symbol. `nohup` still works for SIGHUP immunity.
long-task &Same `&` operator. Fish has no `nohup` builtin but the external `nohup` works. Fish jobs do NOT block on exit when backgrounded — closing the terminal kills them like bash.
Start-Process notepadAliased as `saps`. Launches a new process WITHOUT waiting; returns immediately. Key parameters: `-Wait` (block until exit), `-NoNewWindow` (inherit current console), `-Verb RunAs` (elevate via UAC), `-RedirectStandardOutput file` (capture stdout), `-WindowStyle Hidden` (no window for GUI apps).
start /b long-taskBuilt-in `start`. `/b` (background, no new window), `/wait` (synchronous), `/min` (minimised), `/max` (maximised), `/i` (clean environment). Pass arguments AFTER the binary: `start /b notepad C:\file.txt`. Without `/b`, opens a new console window.
Worked examples
Launch an app in the background
long-task &Start-Process long-taskstart /b long-taskRun with elevated privileges
sudo cmdStart-Process pwsh -Verb RunAspowershell -Command "Start-Process cmd -Verb RunAs"Capture stdout / stderr to a file
long-task > out.log 2>&1 &Start-Process long-task -RedirectStandardOutput out.log -RedirectStandardError err.logstart /b long-task > out.log 2>&1Gotchas
- `Start-Process` does NOT capture stdout / stderr into the pipeline — it launches the process detached. To get output programmatically you MUST use `-RedirectStandardOutput` and `-RedirectStandardError` to files, then read them back; or use `&` (call operator) instead of `Start-Process` for inline execution that streams output.
- `Start-Process -Wait` makes the cmdlet block, but the returned `[Process]` object's `.ExitCode` is `$null` UNLESS you ALSO pass `-PassThru`. The right combination for capturing exit code: `$p = Start-Process foo -Wait -PassThru; $p.ExitCode`. A common bug is using one without the other and getting `$null`.
- Argument passing is fiddly: `Start-Process notepad C:\file.txt` works, but with multi-word args you need `-ArgumentList`: `Start-Process notepad -ArgumentList 'C:\path with spaces\file.txt'`. Each element of the list becomes a separate argv entry. PowerShell's tokenisation around this is famously error-prone — quote aggressively.
- `-Verb RunAs` triggers UAC even when launching pwsh from an already-elevated session, because the new process starts in a fresh token (sudo-style behaviour). To run as a DIFFERENT user, use `-Credential` plus `Start-Process pwsh -Credential (Get-Credential)`, which prompts for the target user's password.
- Detached processes survive the launching shell BY DEFAULT — unlike Unix `&` which dies on SIGHUP. To make a Windows process die with its parent, use Job Objects (`[Win32]::AssignProcessToJobObject` via P/Invoke) — there is no built-in cmdlet flag for that.
WSL & PowerShell Core notes
Common tasks using start-process
- Restart a process
Stop and re-launch a running process — useful for picking up config changes, recovering from leaks, and orchestrated reloads.
- Run a command as a daemon
Detach a process from the controlling terminal and any parent shell — so it keeps running after logout, SSH disconnect, or terminal close.
- Run a command as a different user
Execute a command under another user's identity — for testing service accounts, accessing other users' files, and running as root.