Programming Field

Tskill - DOS/Command Prompt Reference

[Windows XP or later] Terminates the running process (program) forcefully.

Syntax

tskill[.exe] {<process-id> | <process-name>} [/SERVER:<server-name>] [/ID:<session-id> | /A] [/V]

Options

<process-id> | <process-name>

Specifies either <process-id> or <process-name>, which are the ID or name (usually, excluding the extension from the executable file name) of the process you want to terminate. IDs can be obtained using tools like Tasklist. Wildcards can be used in names.

If you specify <process-name>, all processes matching the name will be terminated. Be cautious for specifying ‘*’, as it will forcefully terminate all processes.

/SERVER:<server-name>

Specifies the name of the server where the specified process is running. <server-name> will be the hostname or IP address. If /SERVER is not specified, it terminates the local process.

If /SERVER is specified and <process-name> is specified, /ID or /A must be specified. (If <process-id> is specified, /ID or /A is not required.)

/ID:<session-id> Specifies the ID (numeric) of the session to which the process belongs. Session IDs can be confirmed using tools like Tasklist.
/A Targets all sessions when searching for processes.
/V Outputs detailed information. Specifically, it outputs the ID of the process when the process is terminated.

Details

There is a similar command called Taskkill, but Tskill has the characteristics of ‘always forcibly terminating processes’ and ‘specifying processes only by ID or name’. It can be used with a simple syntax like ‘tskill <process-id/name>’, making it convenient for quickly terminating processes when needed.

Tskill sets an exit code. If it is ‘1’, it indicates that the process was not found. Generally, the code ‘0’ indicates successful, but for Tskill, it is returned when the process is terminated or when the process cannot be terminated. Therefore, even if ‘0’ is returned, it does not guarantee that the process has been terminated.

Samples

Sample 1

tskill notepad

Terminates all running instances of ‘notepad’ on the local computer. Due to the forceful termination, any unsaved data will be lost.

Sample 2

tskill google*

Forcefully terminates all processes on the local computer whose names start with ‘google’.

See also