TclX provides a kill command only for Unix(-like) systems.

kill ?-pgroup? ?signal? idlist

Kill on Windows

"kill" is rather foreign to Windows programming.

(LV I don't understand why this would be so - how is kill different than the control-alt-del End Task?)

From a programming standpoint, one generally sends a {WM_CLOSE,WM_QUIT,...} to a Win32 application (Tcl programmers can "send" such messages with winutil::sendmessage).

Windows workers also should be aware of

  • the sample /samples/sdktools/winnt/tlist/kill.c included with the Win32 SDK (still there in recent versions?)
  • the "WinTop" or "Windows Process Watcher" (it has had different names at different times) utility that Microsoft makes available as part of its "Kernel Toys" [1 ]

TV The idea is that one has processes, also on windows, which are assigned 'running time' by a 'scheduler/dispatcher/time slicer/...' process which is part of the kernel, lets say the thing that runs when windows runs, and that that thing has a list of processes it maintains as part of the pool of processes that might get some processor time at some point, and than by that thing get that, for instance in round-robin fashing when of equal priority. A process can be not taking part in the multitasking form of semi-parallel running processes while waiting for something, and the process can be terminated somehow, so that it is no longer part of the pool of processes the operating system considers active, and its memory and place in the running process list can be forgotten and reused.

Normally, one would want the termination of a process do go strickly under our control, neatly, and *when* we want to, for sure, which is all very debatable, and in practice at times problematic, especially under windows.

Under unix, you'd want the process to call a special OS function exit(), which never returns, under windows similar things can happen. The idea is that signals under unix, and a sort of comparable idea under windows can inform a program (running as one or more processes) that there is a request to terminate it, or that that will happen soon, so that it can clean up and save some stuff, and things can go gracefully.

Under unix, the command to send what are called signals, of which KILL is one, and often TERM(inate) another, is called kill:

   kill -KILL <process_id>

under unix, when the issuer of it has sufficient rights, for almost certain makes sure that some milli seconds later the process with that PID (process identifier number) is killed.

Under windows, I don't remember exactly for older versions, but under recent XP there is a similar command, albeit more simplistic, and as I remember only intended for what the name suggests (in unix, kill can also put a process to sleep or alert it and some more things) called tskill:

   tskill <windows_PID>

Under unix/linux, the command ps gives you the PID's, to get all processes visible to you given your rights is:

   ps -aef | more

Under windows, you'd have to check the task manager window. Unless you have cygwin installed, than cygwin-started processes have a ps compatible PID, and you can use the cygwin kill, or you can use:

   ps -W

to get a list of windows processes and their windows PID suitable for use with tskill.

SO Oct 13, 2001

 Well, everyone, there IS a Santa Claus.

 For windows98 (at least), tlist.exe and kill.exe are available from MS:
 (tlist gets you all the pids running)

 tlist and kill from the NT Resource kit *will not work* on win 98.
 (Yes, I *TRIED* them both, you never know for sure...)

 I hope that others may find this both helpful and useful.

 I *think* that the win95 resource kit is still downloadable
 somewhere on the MS site.

EF Nov 04, 2004

Sysinternals is making available a number of freeware [2 ] for process listing, killing, etc. These are very capable utilities and I have been using them extensively. They are tuned for being called from the command line!

The TWAPI extension also has a built-in "kill" command called end_process - see [3 ]

In a newsgroup posting [4 ], Victor Wagner nicely illustrates the "graceful degradation" or "graduated capability" idiom with kill as an example.

RS: On my Win XP I see a taskkill command:

 TASKKILL [/S system [/U username [/P [password]]]]
         { [/FI filter] [/PID processid | /IM imagename] } [/F] [/T]

    This command line tool can be used to end one or more processes.
    Processes can be killed by the process id 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.

    /F                     Specifies to forcefully terminate

    /FI   filter           Displays a set of tasks that match a
                           given criteria specified by the filter.

    /PID  process id       Specifies the PID of the process that
                           has to be terminated.

    /IM   image name       Specifies the image name of the process
                           that has to be terminated. Wildcard '*'
                           can be used to specify all image names.

    /T                     Tree kill: terminates the specified process
                           and any child processes which were started by it.

    /?                     Displays this help/usage. sounds too good to be true.

MHo Take a look at and . The command line tool pv.exe has a rich set of switches available. To only list tasks, one can use the Windows Resource Kit Tools pulist or scrlist (for services) or sysinternal's pslist.

kostix (06-Sep-2007) notes that utilities from Sysinternals have one bad property: they ask you to accept their lisence terms the first time you run each of them, thus posing certain barrier to using them for scripting.


The tclkill package provides a cross-platform "kill" command.

tclkill has been incorporated into odielib