Windows offers you many different ways to terminate a process. It can be done with Task Manager, with the console tool taskkill and with a huge number of third party apps. Let's see one more method. Today, we will see how to end a process using PowerShell.
Advertisеment
PowerShell comes with a useful cmdlet "Stop-Process". It allows you to terminate a single process or multiple processes. There are several ways to use it.
Let's see how.
How to end a process with PowerShell
Table of contents
Terminate a process by its ID
If you know the process ID you want to kill, you can use it in the Stop-Process cmdlet. If you do not know it, you can use the Get-Process cmdlet to find it. Run it without parameters to get the list of processes with their IDs. See the following screenshot:
In this example, I am going to kill regedit.exe. Its ID is 3420. It should be done as follows:
Stop-Process 3420
Note: to terminate an elevated process, you need to open PowerShell as Administrator. Please refer to the following article:
All ways to open PowerShell in Windows 10
Otherwise you'll get the following error message: "Access is denied".
It works from the elevated instance:
Terminate a process by its name
Another way to use Stop-Process is killing process by its name. The syntax is as follows:
Stop-Process -processname regedit
You can even end multiple apps at once by typing their process names delimited by a comma:
Stop-Process -processname regedit, regownershipex
The above command will terminate Registry Editor and the RegOwnershipEx app.
Tip: for the Stop-Process cmdlet, you can use the following short aliases:
spps kill
For the Get-Process cmdlet, use the following aliases:
gps ps
Support us
Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:
If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!
Advertisеment
Thank you. I remember reading about this long ago, but forgot how to do it!
You are welcome.
Hi, thank you very much for the stop-process -processname “NAMEOFAPPLICATIONHERE” without quotes help.
I was wondering, if I use stop-process, does it close the application safely, just like Windows does, or does it force-close it which results in data loss with apps, for example, that have my database inside.
Closing a database on my computer that uses about 10GB of system memory takes a few seconds to save to disk.
Thanks.