Команда TASKKILL — завершить процесс.
Команда TASKKILL используется для завершения процессов по идентификаторам или именам исполняемых файлов на локальной или удаленной системе. Используется в операционных системах Windows XP и старше.
Формат командной строки:
Описание параметров командной строки :
/S система — Имя или IP-адрес удаленного компьютера.
/U [домен\]пользователь — Пользовательский контекст, в котором должна выполняться эта команда.
/P пароль — Пароль для этого пользовательского контекста. Запрашивается, если он не задан.
/FI фильтр — Применение фильтра для выбора набора задач. Разрешение использовать «*». Пример, imagename eq acme*
/PID процесс — Идентификатор процесса, который требуется завершить. Используйте TaskList, чтобы получить PID.
/IM образ — Имя образа процесса, который требуется завершить. Знак подстановки «*» может быть использован для указания всех заданий или имен образов.
/T — Завершение указанного процесса и всех его дочерних процессов.
/F — Принудительное завершение процесса.
/? — Вывод справки по использованию.
| Имя фильтра ———— STATUS IMAGENAME MODULES | Допустимые операторы ————— eq, ne eq, ne eq, ne, gt, lt, ge, le eq, ne | Допустимые значения ————————- RUNNING | NOT RESPONDING | UNKNOWN Имя образа Значение PID Номер сессии Время CPU в формате hh:mm:ss. hh — часы, mm — минуты, ss — секунды Использование памяти в КБ Имя пользователя в формате [домен\]пользователь Имя DLL Имя службы Заголовок окна |
  Примечание:
1) Символ ‘*’ для параметра /IM применим только совместно с фильтрами.
2) Завершение удаленных процессов всегда будет принудительным (/F).
3) Фильтры «WINDOWTITLE» и «STATUS» не принимаются во внимание, когда компьютер является удаленным.
Примеры использования TASKKILL.
taskkill /? > taskkill.txt — выдать справку по использованию команды в текстовый файл taskill.txt
TASKKILL /IM notepad.exe — завершить процесс, исполняемым образом которого является notepad.exe . Если таких процессов более одного — то будут завершены все.
taskkill /PID 1234 /T — завершить процесс с идентификатором 1234 и все его дочерние процессы ( /T ) . Одной командой можно завершить несколько процессов, задавая их PID — taskkill /PID 1234 /PID 2345 /PID 800 . Для определения идентификатора процессов используется команда tasklist :
tasklist | find /I «notepad» — отобразить информацию для процессов с именем, содержащим строку notepad . В ответ будет выдано сообщение, например:
notepad.exe        824 Console       1       3 916 КБ
notepad.exe      3004 Console       1      18 812 КБ
Где 824 и 3004 — это идентификаторы процессов PID
TASKKILL /F /FI «PID ge 2000» /FI «WINDOWTITLE eq Arc*» — принудительно (/F) завершить процесс, идентификатор которого больше или равен 2000 и заголовок окна которого , начинается с текста Arc
TASKKILL /F /FI «USERNAME eq NT AUTHORITY\SYSTEM» /IM notepad.exe — принудительно завершить процесс, выполняющийся в контексте учетной записи NT AUTHORITY\SYSTEM и исполняемый файл которого имеет имя notepad.exe
TASKKILL /S 192.168.0.243 /U MyDomain\user /FI «USERNAME ne NT*» /IM * — завершить все процессы, выполняющиеся в контекстах учетных записей, не начинающихся со строки NT на компьютере с IP-адресом 192.168.0.243. При подключении к удаленной системе используется имя пользователя user в домене Mydomain . Пароль не задан и будет запрошен при выполнении команды.
TASKKILL /S SERVER /U Mydomain\User /P UserPass /FI «IMAGENAME eq note*» — завершить все процессы, имя исполняемого файла которых начинается со строки note на удаленном компьютере с именем SERVER .
При завершении процессов как локально, так и удаленно, результат выполнения команды TASKKILL зависит от прав пользователя, в контексте учетной записи которого выполняется команда.
Для использования в многопользовательской конфигурации системы, например на сервере терминалов, вместо команды TASKKILL, удобнее и безопаснее использовать команду TSKILL, адаптированную для завершения процессов в среде конкретных пользователей удаленного рабочего стола (RDP).
Если вы желаете поделиться ссылкой на эту страницу в своей социальной сети, пользуйтесь кнопкой «Поделиться»
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.
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
18 Answers 18
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)
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:
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
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
Result for windows
In my case 8080 is the port I wants to kill
And 18264 is the PID listening to the port 8080
So the task you have to kill is the pid for the particular port
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.











