次の方法で共有


Taskkill

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

Taskkill

Ends one or more tasks or processes. Processes can be killed by process ID or image name.

Syntax

taskkill [/s Computer [/u Domain**\UserName [/p** Password]]] {[/fi Filter [/fi Filter [ ... ]]] [{/pid ProcessID | /im ImageName}] | /pid ProcessID | /im ImageName} [/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 \ UserName
    Runs the command with the account permissions of the user specified by UserName or Domain**\**UserName. /u can be specified only when /s is specified. 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 Filter
    Specifies the types of process(es) to include in or exclude from termination. You can specify more than one filter. Use the wildcard (*) to specify all tasks or image names. The following are valid filter names, operators, and values.
<table>
<colgroup>
<col style="width: 33%" />
<col style="width: 33%" />
<col style="width: 33%" />
</colgroup>
<thead>
<tr class="header">
<th>Name</th>
<th>Operators</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><p><strong>Status</strong></p></td>
<td><p><strong>eq</strong>, <strong>ne</strong></p></td>
<td><p><strong>RUNNING</strong> | <strong>NOT RESPONDING</strong> | <strong>UNKNOWN</strong></p></td>
</tr>
<tr class="even">
<td><p><strong>Imagename</strong></p></td>
<td><p><strong>eq</strong>, <strong>ne</strong></p></td>
<td><p>Any valid string.</p></td>
</tr>
<tr class="odd">
<td><p><strong>PID</strong></p></td>
<td><p><strong>eg</strong>, <strong>ne</strong>, <strong>gt</strong>, <strong>lt</strong>, <strong>ge</strong>, <strong>le</strong></p></td>
<td><p>Any valid positive integer.</p></td>
</tr>
<tr class="even">
<td><p><strong>Session</strong></p></td>
<td><p><strong>eg</strong>, <strong>ne</strong>, <strong>gt</strong>, <strong>lt</strong>, <strong>ge</strong>, <strong>le</strong></p></td>
<td><p>Any valid session number.</p></td>
</tr>
<tr class="odd">
<td><p><strong>CPUTime</strong></p></td>
<td><p><strong>eq</strong>, <strong>ne</strong>, <strong>gt</strong>, <strong>lt</strong>, <strong>ge</strong>, <strong>le</strong></p></td>
<td><p>Valid time in the format of <em>HH</em><strong>:</strong><em>MM</em><strong>:</strong><em>SS</em>. The <em>MM</em> and <em>SS</em> parameters should be between 0 and 59 and <em>HH</em> can be any valid unsigned numeric value.</p></td>
</tr>
<tr class="even">
<td><p><strong>Memusage</strong></p></td>
<td><p><strong>eg</strong>, <strong>ne</strong>, <strong>gt</strong>, <strong>lt</strong>, <strong>ge</strong>, <strong>le</strong></p></td>
<td><p>Any valid integer.</p></td>
</tr>
<tr class="odd">
<td><p><strong>Username</strong></p></td>
<td><p><strong>eq</strong>, <strong>ne</strong></p></td>
<td><p>Any valid user name ([<em>Domain</em><strong>\</strong>]<em>UserName</em>).</p></td>
</tr>
<tr class="even">
<td><p><strong>Services</strong></p></td>
<td><p><strong>eq</strong>, <strong>ne</strong></p></td>
<td><p>Any valid string.</p></td>
</tr>
<tr class="odd">
<td><p><strong>Windowtitle</strong></p></td>
<td><p><strong>eq</strong>, <strong>ne</strong></p></td>
<td><p>Any valid string.</p></td>
</tr>
<tr class="even">
<td><p><strong>Modules</strong></p></td>
<td><p><strong>eq</strong>, <strong>ne</strong></p></td>
<td><p>Any valid string.</p></td>
</tr>
</tbody>
</table>
  • /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
    Terminates the specified process and any child processes which that process started.
  • /?
    Displays help at the command prompt.
Remarks
  • The "WindowTitle" and "Status" filters are not supported when a remote system is specified.

  • 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 /pid 2134 /t /fi "username eq administrator"

taskkill /f /fi "PID ge 1000" /im *

Formatting legend

Format Meaning

Italic

Information that the user must supply

Bold

Elements that the user must type exactly as shown

Ellipsis (...)

Parameter that can be repeated several times in a command line

Between brackets ([])

Optional items

Between braces ({}); choices separated by pipe (|). Example: {even|odd}

Set of choices from which the user must choose only one

Courier font

Code or program output

See Also

Concepts

Command-line reference A-Z
Command shell overview