You are here:
∼ Kill a process with tskill or taskkill.
Here is how to Kill a process with tskill or taskkill.
Got a program that is stuck, like Outlook or Excel, say’s it is running but it doesn’t show up in the Applications window of the Task Manager? There is likely a process running for it. Find the task in the task manager and then click End Process… but that is a lot of mouse clicks. Try it with a few key strokes instead.
Here is the command using tskill.
Tskill is a command in Windows XP and back. It is also in Windows Vista and Windows 7, though sometimes it just doesn’t work.
tskill excel
Here is the full command line argument list for tskill:
Ends a process.
TSKILL processid | processname [/SERVER:servername] [/ID:sessionid | /A] [/V]
processid Process ID for the process to be terminated.
processname Process name to be terminated.
/SERVER:servername Server containing processID (default is current).
/ID or /A must be specified when using processname
and /SERVER
/ID:sessionid End process running under the specified session.
/A End process running under ALL sessions.
/V Display information about actions being performed.
Here is the command for taskkill.
If tskill doesn’t work, you can use the taskkill utility. It is a little more complex, but it is more powerful as well.
taskkill /im excel.exe
Suppose you get the message that the process cannot be killed, but you can force it. Then use the /f switch to force kill it.
ERROR: The process “Excel.exe” with PID 7392 could not be terminated.
Reason: This process can only be terminated forcefully (with /F option).
taskkill /im excel.exe /f
Here is the full command line argument list for taskkill, it is pretty complex, or rather you can do quite a lot with it:
taskkill /?
TASKKILL [/S system [/U username [/P [password]]]]
{ [/FI filter] [/PID processid | /IM imagename] } [/T] [/F]
Description:
This tool is used to terminate tasks by process id (PID) or image name.
Parameter List:
/S system Specifies the remote system to connect to.
/U [domain\]user Specifies the user context under which the
command should execute.
/P [password] Specifies the password for the given user
context. Prompts for input if omitted.
/FI filter Applies a filter to select a set of tasks.
Allows “*” to be used. ex. imagename eq acme*
/PID processid Specifies the PID of the process to be terminated.
Use TaskList to get the PID.
/IM imagename Specifies the image name of the process
to be terminated. Wildcard ‘*’ can be used
to specify all tasks or image names.
/T Terminates the specified process and any
child processes which were started by it.
/F Specifies to forcefully terminate the process(es).
/? Displays this help message.
Filter Name Valid Operators Valid Value(s)
———– ————— ————————-
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.
CPUTIME eq, ne, gt, lt, ge, le CPU time in the format
of hh:mm:ss.
hh – hours,
mm – minutes, ss – seconds
MEMUSAGE eq, ne, gt, lt, ge, le Memory usage in KB
USERNAME eq, ne User name in [domain\]user
MODULES eq, ne DLL name
SERVICES eq, ne Service name
WINDOWTITLE eq, ne Window title
1) Wildcard ‘*’ for /IM switch is accepted only when a filter is applied.
2) Termination of remote processes will always be done forcefully (/F).
3) “WINDOWTITLE” and “STATUS” filters are not considered when a remote
machine is specified.
TASKKILL /IM notepad.exe
TASKKILL /PID 1230 /PID 1241 /PID 1253 /T
TASKKILL /F /IM cmd.exe /T
TASKKILL /F /FI “PID ge ; /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*”
Hope this helps!
Article written by
Hi there, I am Jesse Perry. I have run an IT Service business for over a decade, been working in the Computer Industry for much longer.
on Twitter.
* indicates required field
First Name: *
Last Name: *
CAPTCHA Code: *如何打造完美龙宫 从完善每一个细节开始_百度知道