Tasklist
Displays a list of applications and services with their Process ID (PID) for all tasks running on either a local or a remote computer.
Syntax
tasklist[.exe] [/scomputer] [/udomain\user [/ppassword]] [/fo {TABLE|LIST|CSV}] [/nh] [/fiFilterName [/fiFilterName2 [ ... ]]] [/m [ModuleName] | /svc | /v]
Parameters
/s Computer : Specifies the name or IP address of a remote computer (do not use backslashes). The default is the local computer.
/u Domain \ User : Runs the command with the account permissions of the user specified by User or Domain\User. The default is the permissions of the current logged on user on the computer issuing the command.
/p Password : Specifies the password of the user account that is specified in the /u parameter.
/fo {TABLE|LIST|CSV} : Specifies the format to use for the output. Valid values are TABLE, LIST, and CSV. The default format for output is TABLE.
/nh : Suppresses column headers in the output. Valid when the /fo parameter is set to TABLE or CSV.
/fi FilterName : Specifies the types of process(es) to include in or exclude from the query. The following table lists valid filter names, operators, and values.
Name | Operators | Value |
---|---|---|
Status | eq, ne | RUNNING|NOT RESPONDING |
Imagename | eq, ne | Any valid string. |
PID | eq, ne, gt, lt, ge, le | Any valid positive integer. |
Session | eq, ne, gt, lt, ge, le | Any valid session number. |
SessionName | eq, ne | Any valid string. |
CPUTime | eq, ne, gt, lt, ge, le | Valid time in the format of hh:mm:ss. The mm and ss parameters should be between 0 and 59 and hh can be any valid unsigned numeric value. |
Memusage | eq, ne, gt, lt, ge, le | Any valid integer. |
Username | eq, ne | Any valid user name ([Domain\]User). |
Services | eq, ne | Any valid string. |
Windowtitle | eq, ne | Any valid string. |
Modules | eq, ne | Any valid string. |
/m [ ModuleName ] : Specifies to show module information for each process. When a module is specified, all the processes using that module are shown. When a module is not specified, all the processes for all the modules are shown. Cannot be used with the /svc or the /v parameter.
/svc : Lists all the service information for each process without truncation. Valid when the /fo parameter is set to TABLE. Cannot be used with the /m or the /v parameter.
/v : Specifies that verbose task information be displayed in the output. Cannot be used with the /svc or the /m parameter.
/?: Displays help at the command prompt.
Remarks
- Tasklist is a replacement for the TList tool.
Examples
The following examples show how you can use the tasklist command:
tasklist /v /fi “PID gt 1000” /fo csv
tasklist /fi “USERNAME ne NT AUTHORITY\SYSTEM” /fi “STATUS eq running”
tasklist /v /fi “STATUS eq running”
tasklist /s srvmain /nh
tasklist /s srvmain /s srvny
tasklist /s srvmain /u maindom\hiropln /p p@ssW23 /nh
Taskkill
Syntax
taskkill [/sComputer] [/uDomain\User [/pPassword]]] [/fiFilterName] [/pidProcessID]|[/imImageName] [/f][/t]
Parameters
/s Computer : Specifies the name or IP address of a remote computer (do not use backslashes). The default is the local computer.
/u Domain \ User : Runs the command with the account permissions of the user specified by User or Domain\User. The default is the permissions of the current logged on user on the computer issuing the command.
/p Password : Specifies the password of the user account that is specified in the /u parameter.
/fi FilterName : Specifies the types of process(es) to include in or exclude from termination. The following are valid filter names, operators, and values.
Name | Operators | Value |
---|---|---|
Hostname | eq, ne | Any valid string. |
Status | eq, ne | RUNNING|NOT RESPONDING |
Imagename | eq, ne | Any valid string. |
PID | eg, ne, gt, lt, ge, le | Any valid positive integer. |
Session | eg, ne, gt, lt, ge, le | Any valid session number. |
CPUTime | eq, ne, gt, lt, ge, le | Valid time in the format of hh:mm:ss. The mm and ss parameters should be between 0 and 59 and hh can be any valid unsigned numeric value. |
Memusage | eg, ne, gt, lt, ge, le | Any valid integer. |
Username | eq, ne | Any valid user name ([Domain\]User). |
Services | eq, ne | Any valid string. |
Windowtitle | eq, ne | Any valid string. |
/pid ProcessID : Specifies the process ID of the process to be terminated.
/im ImageName : Specifies the image name of the process to be terminated. Use the wildcard (*) to specify all image names.
/f : Specifies that process(es) be forcefully terminated. This parameter is ignored for remote processes; all remote processes are forcefully terminated.
/t : Specifies to terminate all child processes along with the parent process, commonly known as a tree kill.
/?: Displays help at the command prompt.
Remarks
- The wildcard character (*) is accepted only when specified along with the filters.
- Termination for remote processes will always be done forcefully regardless of whether the /f parameter is specified.
- Supplying a computer name to the HOSTNAME filter will cause a shutdown and all processes will be stopped.
- Use tasklist to determine the Process ID (PID) for the process to be terminated.
- Taskkill is a replacement for the Kill tool.
Examples
The following examples show how you can use the taskkill command:
taskkill /pid 1230 /pid 1241 /pid 1253
taskkill /f /fi “USERNAME eq NT AUTHORITY\SYSTEM” /im notepad.exe
taskkill /s srvmain /f /im notepad.exe
taskkill /s srvmain /u maindom\hiropln /p p@ssW23 /fi “IMAGENAME eq note*” /im *
taskkill /s srvmain /u maindom\hiropln /fi “USERNAME ne NT*” /im *
taskkill /f /fi “PID ge 1000” /im *