TASKKILL
Terminates a running task by process ID or name.
TASKKILL [/S system [/U username [/P [password]]]] [/FI filter] [/PID id | /IM name] [/T] [/F]
Where:
/S system- Specifies the remote system on which the task to be terminated is located. If not specified, the local system will be assumed. If a remote system is specified, this implies the/Foption and theSTATUSandWINDOWTITLEfilters will be ignored./U username- Specifies the user account associated with the process to be terminated./P [password]- Specifies the password associated with the userusername. If not specified, the user running the command will be prompted for it./FI filter- Specifies a filter to consider a set of activities. You can specify the wildcardwildcard*. The following table lists the possible filters to use with this option:Left-hand operand Possible operators Possible right-hand operands STATUSEQ,NERUNNING,NOT RESPONDING,UNKNOWNIMAGENAMEEQ,NEimage_namePIDEQ,NE,GT,LT,GE,LEprocess_idSESSIONEQ,NE,GT,LT,GE,LEsession_numberCPUTIMEEQ,NE,GT,LT,GE,LEhh:mm:ssMEMUSAGEEQ,NE,GT,LT,GE,LEmem_in_kbUSERNAMEEQ,NE[domain\]userMODULESEQ,NEdll_nameSERVICESEQ,NEservice_nameWINDOWTITLEEQ,NEwindow_title/PID id- Specifies the ID of the process to kill. You can use the TASKLISTTASKLIST command to get a complete list of process IDs./IM name- Specifies the image name of the process to kill. You can specify the wildcardwildcard*./T- Terminate the process with all the child processes./F- Force closes processes.
Note that the /PID id option is equivalent to /FI "PID EQ id", while /IM name is equivalent to /FI "IMAGENAME EQ name". However, there is a difference if more than one options are specified: while a sequence of options /PID id1 /PID id2 [...] or /IM name1 /IM name2 indicates the processes to terminate disjointly, specifying more filters indicates that all properties must be verified for the tasks to be killed. In other words, /PID 1 /PID 2 will terminate processes with IDs 1 and 2, while /FI "PID EQ 1" /FI "PID EQ 2" will always indicate an empty set of tasks, since none of them can have two different IDs at the same time.
Examples:
1. Terminate processes with IDs 1, 2 and 3 and all processes that depend on them:
taskkill /pid 1 /pid 2 /pid 3 /t
2. Kill processes with IDs greater than or equal to 1000 with a title starting with Hello every*, forcing them to quit:
taskkill /f /fi "pid ge 1000" /fi "windowtitle eq Hello every*"
3. Terminate processes with an image name that starts with culardo in the remote system myneighbor for user luser with password passwrod>
taskkill /s myneighbor /u luser /p passwrod /fi "imagename eq culardo*"
Comments