Skip to content
shellmap

start-processLaunch a detached or elevated process across all 5 shells

Equivalents in every shell

Bashunix
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 &`.

Zshunix
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.

Fishunix
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.

PowerShellwindows
Start-Process notepad

Aliased 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).

cmd.exewindows
start /b long-task

Built-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

Bash
long-task &
PowerShell
Start-Process long-task
cmd.exe
start /b long-task

Run with elevated privileges

Bash
sudo cmd
PowerShell
Start-Process pwsh -Verb RunAs
cmd.exe
powershell -Command "Start-Process cmd -Verb RunAs"

Capture stdout / stderr to a file

Bash
long-task > out.log 2>&1 &
PowerShell
Start-Process long-task -RedirectStandardOutput out.log -RedirectStandardError err.log
cmd.exe
start /b long-task > out.log 2>&1

Gotchas

  • `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

pwsh`Start-Process` is available on every pwsh platform but the parameter surface differs: `-Verb RunAs` is Windows-only (UAC), `-WindowStyle` is mostly Windows (Linux/macOS pwsh accepts it but it has no effect on most terminal apps), `-LoadUserProfile` is Windows-only. Cross-platform scripts should stick to `-FilePath`, `-ArgumentList`, `-WorkingDirectory`, `-RedirectStandard*`, and `-Wait` — these work uniformly. For elevation on Linux/macOS, shell out to `sudo` via `& sudo` instead.
WSLFrom Windows-side pwsh, `Start-Process wsl.exe -ArgumentList "long-task"` launches a process inside WSL. From inside WSL bash, you cannot directly invoke `Start-Process`; use `pwsh.exe -c "Start-Process notepad"` over interop, or invoke Windows binaries directly (`notepad.exe file.txt &`). Detached WSL processes (`nohup ... &`) survive logout from the WSL session but NOT a `wsl --shutdown`, which terminates the entire WSL VM.

Common tasks using start-process

Related commands