Windows taskkill Command Tutorial – Kill Process via Command Line

Windows command line or MS-DOS provides the taskkill command in order to kill processes via the command prompt. The task kill command has different features to be used while killing processes. In this tutorial, we will learn how to kill a task in Windows in different ways with the taskkill command.

taskkill Command Syntax

The taskkill command has the following syntax.

taskkill OPTIONS PROCESS
  • OPTIONS is different options used to kill given process. This parameter is optional.
  • PROCESS is the process specifier which can be the Process ID or Process name. This parameter is required.

taskkill Command Parameters

The taskkill command accepts the following parameters.

ParameterDescription
/sRemote Computer Hostname or IP Address
/uSpecify username
/pSpecify Password for the user
/fiFilter and match the process to kill according to the process name and other attributes
/pidSpecify process ID to kill
/imSpecify image name of the process to kill
/fForce to kill
/tKill the child processes as well

Kill Process with taskkill Command

The easiest way to kill a process with the taskkill command is using the /pid parameter and providing the process ID of the process. The process ID can be displayed in different ways but the tasklist command can be used from the command line to display process names and process ID.

tasklist

We will find the task or process ID and provide it into the taskkill command.

taskkill /pid 1230

Kill Multiple Processes with taskkill Command

The taskkill command can also used to kill multiple processes in a single shot. Just provides every process ID with different /pid option.

taskkill /pid 1230 /pid 3420 /pid 1253

Kill Process with Process Name

Another powerfull and useful features of the taskkill is killing a process with its name. Actually not a single processes is kill with the name. All processes which has given name will be killed.

taskkill /im firefox.exe

Run taskkill Command As Different User

In a system, multiple users can execute processes. The current user can easily kill its processes but another user process can not be killed if you are not an administrator. The taskkill command can use another user account to kill its processes. Even the Administrator user can be provided to kill every process without the need for the extra privilege. The /u option is used to specify the user name.

taskkill /u "ismail" /pid 2345

Kill Process Forcibly with taskkill Command

The taskkill command provides the ability to kill processes forcibly. This could be helpful if process is stuck and do not responds to the kill request. The /f option is used to kill process forcibly.

taskkill /f /pid 2354

Kill Process of Remote System with taskkill

The taskkill command provides the ability to kill processes remotely. This means the remote system processes can be killed by specifying the remote system hostname or IP address easily. We can also use the remote system username. In the following example, we will specify the remote system with the /s option and provide the remote system hostname. This can be an IP address too. The /u option is used to specify the remote system user which is a domain user in this case where the “testdomain” is the domain name “ismail” is the domain user. The password is provided with the /p option as “NotSecure“.

taskkill /s wintect /u testdomain\ismail /p "NotSecure" /fi "cmd.exe"

Kill Popular Processes/Applications

Some applications are very popular and heavily used where they can stuck regularly. The taskkill command can be used to kill these processes in order to prevent the system bottleneck. Generally high memory and CPU using applications like Google Chrome, Mozilla Firefox or complex commands MS-DOS or PowerShell can be hang on. Below you can find easy way to kill these processes

Application Nametaskkill Command
Google Chrometaskkill /F /IM Chrome.exe
Mozilla Firefoxtaskkill /F /IM Firefox.exe
MS-DOS or cmd.exetaskkill /F /IM cmd.exe
PowerShelltaskkill /F /IM powershell.exe

Leave a Comment