Willing to write some VBScript? You can script this using WMI, a Windows administration API with scripting bindings. WMI can list all the processes on a machine, including image name, path, and command line. Search for the MATLAB.exes. WMI's Win32_Process object also exposes most of the information that Process Explorer shows, like start time, CPU, and memory usage.
You can almost script WMI from within Matlab itself using actxserver() and COM method calls, but the collections don't work quite right yet. But you can write a simple VBS to do the WMI process list query and write Matlab-friendly output, then shell out to it. This is some more work than using tasklist, but you might find the extra info useful if you're wrangling a bunch of worker processes. For example, the command lines, window titles, or process start times could be used to differentiate workers when deciding which to kill.
To kill them, you can use WMI's Win32_Process.Terminate, or shell out to the taskkill command.
This is all Windows-only. If you want to make things portable, you could install cygwin, and then shell out to the Unix-style ps and kill commands on either OS.
Side note: if you're making regular Windows Matlab apps act as workers with "-r", use a try/catch at the very top level of your main script to make sure it exits when done:
try
do_your_work();
catch err
warning('Got an error: %s', err.message);
end
close force all % prevent figures from making quit() balk
quit force
Otherwise, an error thrown in M-code could bubble up to the top level and drop Matlab into the main GUI loop waiting for user input, and it will look like a hung worker.
Oh, and if you're killing Matlab processes from Matlab, you probably want to avoid killing yourself. Here's a MEX function that will let you determine your own pid on Windows64 or Unix; check it against the target processes' pids when choosing victims. Fancier ifdefs will make it work on win32.
/* mygetpid.c - MEX function to get PID */
#ifdef _WIN64
#include <process.h>
#define GETPID _getpid
#else
/* assume we're on Unix */
#include <unistd.h>
#define GETPID getpid
#endif
#include "mex.h"
void mexFunction(int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[]
)
{
/* ... a real function would have nargin/nargout checks here... */
plhs[0] = mxCreateDoubleScalar((int) GETPID());
}