The CMD command uses tasklist and taskkill to close the program and tasklisttaskkill.

Source: Internet
Author: User

The CMD command uses tasklist and taskkill to close the program and tasklisttaskkill.

After the remote server yesterday, the server got stuck for no reason, and the mouse was delayed and unresponsive. If you wanted to close the program in the Process Manager, you also got stuck. After the tangle, win + R enables cmd and restarts with shutdown. During the restart, I thought about how to use the cmd command to manage system processes. It is very convenient to use tasklist and taskkill after searching. The record is as follows:

Run the cmd command to enter tasklist /? Then get

TASKLIST [/S system [/U username [/P [password] [/M [module] |/SVC |/V] [/FI filter] [/FO format] [/NH] Description: the tool displays the list of processes currently running on local or remote machines. Parameter List:/S system specifies the remote system to connect. /U [domain \] user specifies the user context in which the command should be executed. /P [password] specifies a password for the provided user context. If this parameter is omitted, a prompt is displayed. /M [module] lists all tasks with the name of the exe/dll currently used. If no module name is specified, all loaded modules are displayed. /SVC displays the Services hosted in each process. /V displays Detailed task information. /FI filter displays a series of tasks that meet the criteria specified by the filter. /FO format specifies the output format. Valid values: "TABLE", "LIST", and "CSV ". The/NH specified column title should not be displayed in the output. Only valid for "TABLE" and "CSV" formats. /? Displays help messages. Filter: valid value of the filter name operator ------------- -------------------------------- STATUS eq, ne RUNNING | not responding | unknown imagename eq, ne image name PID eq, ne, gt, lt, ge, le PID value: SESSION eq, ne, gt, lt, ge, le SESSION number SESSIONNAME eq, ne SESSION name CPUTIME eq, ne, gt, lt, ge, le CPU time, the format is hh: mm: ss. Hh-hour, mm-minute, ss-second MEMUSAGE eq, ne, gt, lt, ge, le memory usage, unit: kb username eq, ne USERNAME, format: [domain \] user SERVICES eq, ne service name WINDOWTITLE eq, ne window title MODULES eq, ne DLL Name Description: When querying a remote machine, the "WINDOWTITLE" and "STATUS" filters are not supported. Example: TASKLIST/m tasklist/V/fo csv tasklist/SVC/fo list tasklist/M wbem * TASKLIST/S system/fo list tasklist/S system/U domain \ username/FO CSV /nh tasklist/S system/U username/P password/fo table/nh tasklist/FI "USERNAME ne nt authority \ SYSTEM"/FI "STATUS eq running"

Enter taskkill /? Get help information

TASKKILL [/S system [/U username [/P [password] {[/FI filter] [/PID processid |/IM imagename]} [/T] [/ f] Description: use this tool to terminate a task by process ID (PID) or image name. Parameter List:/S system specifies the remote system to be connected. /U [domain \] user specifies the user context in which the command should be executed. /P [password] specifies a password for the provided user context. If this parameter is ignored, a prompt is displayed. /FI filter apply filter to select a group of tasks. "*" Is allowed "*". For example, the image name eq acme */PID processid specifies the PID of the process to be terminated. Use TaskList to obtain the PID. /IM imagename specifies the image name of the process to be terminated. The wildcard '*' can be used to specify the names of all tasks or images. /T terminate the specified process and its sub-processes. /F specifies to force terminate the process. /? Displays help messages. Filter: Filter Name valid operator valid value ------------- --------------------------------- STATUS eq, ne RUNNING | not responding | unknown imagename eq, ne image name PID eq, ne, gt, lt, ge, le PID value: SESSION eq, ne, gt, lt, ge, and le SESSION number. CPUTIME eq, ne, gt, lt, ge, le CPU time, format: hh: mm: ss. Hh-hour, mm-minute, ss-second MEMUSAGE eq, ne, gt, lt, ge, le memory usage, unit: kb username eq, ne USERNAME, the format is [domain \] user MODULES eq, ne DLL name SERVICES eq, ne service name WINDOWTITLE eq, ne window Title Description ---- 1) only when the filter is applied, /IM switching can use the wildcard '*'. 2) the remote process must always be forcibly terminated (/F. 3) when a remote machine is specified, the "WINDOWTITLE" and "STATUS" filters are not supported. For example: TASKKILL/IM notepad.exe TASKKILL/PID 1230/PID 1241/PID 1253/t taskkill/F/IM cmd.exe/t taskkill/F/FI "PID ge 1000"/FI "WINDOWTITLE ne untitle * "TASKKILL/F/FI" USERNAME eq nt authority \ SYSTEM "/IM notepad.exe TASKKILL/S system/U domain \ username/FI" USERNAME ne NT * "/IM * TASKKILL/ S system/U username/P password/FI "IMAGENAME eq note *"

You can also use the tskill command, but it is invalid in win7. The help information obtained on 2012r2 is as follows:

End the process. TSKILL processid | processname [/SERVER: servername] [/ID: sessionid |/A] [/V] Process ID of the Process whose processid is to end. The name of the process whose processname is to end. /SERVER: the SERVER whose servername contains processID (the default value is the current value ). When using the process name and/SERVER, you must specify/ID or/A/ID: sessionid to end the process running in the specified session. /A ends the processes running in all sessions. /V displays the information of the operation being executed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.