Stop one or more running processes. (Kill)
Syntax
Stop-Process -name string[] [-passThru] [-whatIf]
[-confirm] [CommonParameters]
Stop-Process [-id] Int32[] [-passThru] [-whatIf]
[-confirm] [CommonParameters]
Stop-Process -inputObject Process[] [-passThru] [-whatIf]
[-confirm] [CommonParameters]
Key
-name
Process name(s)
Separate multiple process names with commas or use wildcard characters.
-id Int32
Process ID(s) (PID). Use commas to separate multiple PIDs.
To find the PID of a process, type "get-process".
-inputObject
Accept a process object as input to Stop-Process.
A variable, command or expression that returns the process object(s)
-passThru
Pass the object created by Stop-Process along the pipeline.
-whatIf
Describe what would happen if you executed the command without
actually executing the command.
-confirm
Prompt for confirmation before executing the command.
CommonParameters:
-Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutVariable.
Examples
Stop all instances of the Notepad process:
PS C:\>stop-process -name notepad
Stop process ID# 6464 and prompt before stopping the process (this will display the process name first):
PS C:\>stop-process -id 6464 -confirm -passthru
Display processes that were running on the computer, but are now stopped:
PS C:\>get-process | where-object {$_.HasExited}
"Whom the gods love dies young" - Menander 300 BC
Related:
Get-Process - Get a list of processes on a machine
Equivalent bash command: kill - Stop a process from running