- TaskKill: Kill process from command line (CMD)
- Kill a process using image name:
- Kill a process forcibly
- Kill a process with process id:
- More examples
- Windows: TaskKill — Убить Процесс по PID, Имени, Порту — CMD
- Убить Процесс по Имени
- Убить Процесс по PID
- Убить Процесс на Порту
- Возможные Ошибки
- How to Kill a Process in Windows 10
- Kill a process using Taskkill
- Kill a process using PowerShell
- About Sergey Tkachenko
- 10 thoughts on “ How to Kill a Process in Windows 10 ”
- Really killing a process in Windows
- 9 Answers 9
- How do I kill the process currently using a port on localhost in Windows?
- 21 Answers 21
TaskKill: Kill process from command line (CMD)
We can kill a process from GUI using Task manager. If you want to do the same from command line., then taskkill is the command you are looking for. This command has got options to kill a task/process either by using the process id or by the image file name.
Kill a process using image name:
We can kill all the processes running a specific executable using the below command.
Example:
Kill all processes running mspaint.exe:
Kill a process forcibly
In some cases, we need to forcibly kill applications. For example, if we try to to kill Internet explorer with multiple tabs open, tasklist command would ask the user for confirmation. We would need to add /F flag to kill IE without asking for any user confirmation.
/F : to forcibly kill the process. If not used, in the above case it will prompt the user if the opened pages in tabs need to be saved.
To kill Windows explorer, the following command would work
The above command would make all GUI windows disappear. You can restart explorer by running ‘explorer’ from cmd.
Not using /F option, would send a terminate signal. In Windows 7, this throws up a shutdown dialog to the user.
Kill a process with process id:
We can use below command to kill a process using process id(pid).
Example:
Kill a process with pid 1234.
Kill processes consuming high amount of memory
For example, to kill processes consuming more than 100 MB memory, we can run the below command
More examples
Sometimes applications get into hung state when they are overloaded or if the system is running with low available memory. When we can’t get the application to usable state, and closing the application does not work, what we usually tend to do is kill the task/process. This can be simply done using taskkill command.
To kill Chrome browser from CMD
Kill Chromedirver from command line
To kill firefox browser application
To kill MS Word application(Don’t do this if you haven’t saved your work)
Sometimes, the command window itself might not be responding. You can open a new command window and kill all the command windows
This even kills the current command window from which you have triggered the command.
i have a question about this.
I have a process that runs in my domain that puts outlook suspended. As soon as I do a task kill forced as administrator it runs.
I wrote a little script, now i want to add admin rights to the script via GPO.
Windows: TaskKill — Убить Процесс по PID, Имени, Порту — CMD
Иногда приложение в Windows зависает и перестает отвечать, и тогда единственный способ его завершить — «убить» процесс из командной строки
Команда taskkill в Windows служит для завершения задач по имени или по идентификатору процесса (PID).
В этой заметке я показываю, как найти и убить процесс по его имени или по PID, а также как узнать какой процесс слушает порт.
Я также показываю, что делать в случае ошибок «Процесс не может быть прерван» и «Доступ запрещен».
Дельный Совет: Узнать код завершения команды/приложения! Читать далее →
Убить Процесс по Имени
Вывести список всех процессов в Windows и узнать полное имя процесса, который нужно убить (без учета регистра):
Убить процесс по имени:
Убить Процесс по PID
Вывести список всех процессов в Windows и узнать PID процесса, который нужно убить (без учета регистра):
Убить процесс по PID:
Убить Процесс на Порту
Вывести список всех процессов в Windows, слушающих TCP и UDP порты и узнать PID процесса, который слушает определенный порт:
Узнать имя процесса по его PID:
Убить процесс по имени или PID:
Дельный Совет: Аналог grep для CMD и PowerShell в Windows! Читать далее →
Возможные Ошибки
В случае появления следующей ошибки убейте процесс принудительно:
ОШИБКА: процесс с PID XXX не может быть прерван.
Причина: Данный процесс может быть прерван только насильственно с параметром /F.
При получении ошибки «Доступ запрещен», запустите командную строку от имени администратора:
ОШИБКА: процесс с PID XXX не может быть прерван.
Причина: Доступ запрещен.
Чтобы запустить CMD с правами администратора, нажмите клавишу Win , чтобы открыть меню «Пуск», наберите cmd , чтобы найти командную строку и нажмите комбинацию Ctrl + Shift + Enter , чтобы запустить командную строку от имени администратора.
How to Kill a Process in Windows 10
When you start an app, the operating system creates a process for an executable file of the app. It contains the program code and its current activity. Windows assigns a special number known as Process Identifier (PID) which is unique for every process. There are a number of reasons you might want to kill a process, and different methods you can use to terminate it. Here is how it can be done.
To kill a process in Windows 10, do the following.
- Open Task Manager.
- Click on «More details» in the bottom right corner to enter Full view mode.
- Select the desired app in the app list.
- Click on the End task button or hit the Del key on the keyboard.
This is Task Manager’s most well known method.
Note: The same can be done from the Details tab. It is a special tab which lists process names instead of app names. There you can select a process in the list and either click on the End process button or hit the Del key.
Using the End Task button means Windows first tries to see for a certain timeout if the process has really stopped responding, and attempts to collect a crash or memory dump of the process. It then terminates the app.
Tip: We highly recommend you read the article How to end a process quickly with Task Manager in Windows 10 to learn all Task Manager tricks. Also, you can get the classic Task Manager app in Windows 10 to end processes or tasks.
Another classic method to close a process is the console tool taskill. It comes bundled with modern versions of Windows.
Kill a process using Taskkill
Note: Some processes are running as Administrator (elevated). In order to kill them, you need to open an elevated command prompt instance.
- Open the command prompt as the current user or as Administrator.
- Type tasklist to see the list of running processes and their PIDs. Since the list might be very long, you can use a pipe character with the more command.
For example, to kill a process by its PID:
To kill a process by its name:
Taskkill supports many useful options which you can use to terminate apps. You can learn them by running it as follows: taskkill /? . Using taskkill, you can close all not responding tasks at once in Windows 10.
Kill a process using PowerShell
Note: To kill a process which runs elevated, you need to open PowerShell as Administrator.
- Open PowerShell. If required, run it as Administrator.
- Type the command Get-Process to see the list of running processes.
- To kill a process by its name, execute the following cmdlet:
- To kill a process by its PID, run the command:
Examples:
This command will close the notepad.exe process.
The next command will close a process with PID 2137.
If you need to kill a Store app, see the following article:
Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:
Share this post
About Sergey Tkachenko
Sergey Tkachenko is a software developer from Russia who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube.
10 thoughts on “ How to Kill a Process in Windows 10 ”
Some good ways to kill a process, but you forgot Process Explorer, I have been using it since Microsoft bought his company. And have replaced Task Manager with it. Thanks for you description on killing a process with power shell….janek
Well, i’ve tried to cover native methods. Sure, there are tons of extra ways to kill a process.
Is there a way to have tasklist output sorted alphabetically? It truly is a long list.
Thank You
Try
TASKLIST /NH | SORT
tip: does not need to type anything in uppercase 😉
Thank you for this information. I was trying to remote in to work but my outlook was stuck/frozen and could not access anything but command. The taskkill information saved me a long commute in to work.
Thank you for your information on how to kill a Windows process.
Could you possibly advise how to “restart” a process stopped by using taskkill in the command line?
For example, how can taskhostw.exe be restarted in the command line after the using the command “taskkill /F /IM taskhostw.exe” in the command line?
It depends on the process.
If it is a service, you should issue the appropriate command for the service.
If it is a regular executable, you need to start it by typing its executable name and its arguments, if they needed.
Also, there is a start command in the command prompt. Run start /? to see what it can do for you.
Really killing a process in Windows
Occasionally a program on a Windows machine goes crazy and just hangs. So I’ll call up the task manager and hit the «End Process» button for it. However, this doesn’t always work; if I try it enough times then it’ll usually die eventually, but I’d really like to be able to just kill it immediately. On Linux I could just kill -9 to guarantee that a process will die.
This also could be used for writing batch scripts and writing batch scripts is programming.
Is there some program or command that comes with Windows that will always kill a process? A free third-party app would be fine, although I’d prefer to be able to do this on machines I sit down at for the first time.
9 Answers 9
«End Process» on the Processes-Tab calls TerminateProcess which is the most ultimate way Windows knows to kill a process.
If it doesn’t go away, it’s currently locked waiting on some kernel resource (probably a buggy driver) and there is nothing (short of a reboot) you could do to make the process go away.
Unix based systems like Linux also have that problem where processes could survive a kill -9 if they are in what’s known as «Uninterruptible sleep» (shown by top and ps as state D ) at which point the processes sleep so well that they can’t process incoming signals (which is what kill does — sending signals).
Normally, Uninterruptible sleep should not last long, but as under Windows, broken drivers or broken userpace programs ( vfork without exec ) can end up sleeping in D forever.
How do I kill the process currently using a port on localhost in Windows?
How can I remove the current process/application which is already assigned to a port?
For example: localhost:8080
21 Answers 21
Step 1:
Open up cmd.exe (note: you may need to run it as an administrator, but this isn’t always necessary), then run the below command:
with the port number you want, but keep the colon)
The area circled in red shows the PID (process identifier). Locate the PID of the process that’s using the port you want.
Step 2:
Next, run the following command:
(No colon this time)
Lastly, you can check whether the operation succeeded or not by re-running the command in «Step 1». If it was successful you shouldn’t see any more search results for that port number.
Step 1 (same is in accepted answer written by KavinduWije):
Change in Step 2 to:
Note: taskkill is not working in some git bash terminal
With Windows 10 default tools:
Open Windows PowerShell as Administrator
Find PID (ProcessID) for port 8080:
Kill the zombie process:
where «77777» is your PID
If you are using GitBash
( /F forcefully terminates the process)
I know that is really old question, but found pretty easy to remember, fast command to kill app that are using port.
Requirements: npm@5.2.0^ version
You can also read more about kill-port here: https://www.npmjs.com/package/kill-port
Result for Windows Command Prompt
In my case, 8080 is the port I want to kill
And 18264 is the PID listening on port 8080
So the task you have to kill is the PID for that particular port
If you already know the port number, it will probably suffice to send a software termination signal to the process (SIGTERM):
In Windows PowerShell version 1 or later to stop a process on port 3000 type:
Stop-Process (,(netstat -ano | findstr :3000).split() | foreach <$[$.length-1]>) -Force
As suggested by @morganpdx here`s a more PowerShell-ish, better version:
Stop-Process -Id (Get-NetTCPConnection -LocalPort 3000).OwningProcess -Force
For use in command line:
For use in bat-file:
For Windows users, you can use the CurrPorts tool to kill ports under usage easily:
I was running zookeeper on Windows and wasn’t able to stop ZooKeeper running at 2181 port using zookeeper-stop.sh, so tried this double slash «//» method to taskkill. It worked
If you can use PowerShell on Windows you just need :
If you’re using Windows Terminal then the killing process might be little less tedious. I’ve been using windows terminal and kill PID works fine for me to kill processes on the port as the new Windows Terminal supports certain bash commands. For example: kill 13300
So, the complete process will look like this-
- Open Windows Terminal
- Type the following command to show processes running on the port you’re looking to kill processes. netstat -ano | findstr :PORT
- Type following to kill the process. kill PID
See when I typed the first command to list processes on the port it returned empty. That means all processes are killed now.
Update: kill is an alias for Stop-Process. Thanks, @FSCKur for letting us know.