Stop-Process
Stop a process
Stop-Process -Name notepad -WhatIf
- Works on
- WindowsLinuxmacOS
- PowerShell
- 5.1 and later
- Reference
- Microsoft Learn: Stop-Process
Careful: Killing the wrong process can lose work. Filter carefully. Use -WhatIf.
- PowerShell 7 On Linux and macOS, kill runs the system command instead of this cmdlet. Type the full cmdlet name there.
Stops processes. Prefer -Id when more than one process shares a name. -Force skips confirmation in some hosts.
Try this
Get-Process -Name notepad -ErrorAction SilentlyContinue | Stop-Process -WhatIf
Coming from another shell
| Shell | What you might type |
|---|---|
| bash / zsh | kill 1234 |
| cmd.exe | taskkill /PID 1234 |
More in From bash and From cmd.