Syntax error How to stop all instances of the process in PowerShell?

How to stop all instances of the process in PowerShell?



To stop running all the instances of the process in PowerShell Stop-Process command is used. For example, in the below example, we have two running instances of notepad.exe process.

Command

PS C:\WINDOWS\system32> Get-Process notepad

Output

PS C:\WINDOWS\system32> Get-Process notepad

Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName
-------  ------    -----      -----     ------     --  -- -----------
    228      13     3160      13448       0.14  15564   1 notepad
    228      14     3148      13668       0.17  22644   1 notepad

To stop all the instances of the running process, below command will be used.

Stop-Process -Name notepad

You can also pipeline the Stop-Process to end the process.

Get-Process -Name notepad | Stop-Process

To stop multiple processes, provide different process names separated by comma (,)

Get-Process SkypeApp,notepad |Stop-Process -Confirm:$false
Updated on: 2020-01-22T12:25:26+05:30

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements