A Node .js wrapper for Microsoft Windows' tasklist and taskkill
MS-Task is a Node.js wrapper for Microsoft Windows' tasklist and taskkill. Tasklist "displays a list of applications and services with their Process ID (PID) for all tasks running on either a local or a remote computer." Taskkill "ends one or more tasks or processes." Supported versions: Windows XP, Vista, 7, and 8.
You may install MS-Task via NPM as follows:
npm install ms-task
The source code is available on GitHub.
Call tasklist.exe with the supplied
argumentString. A valid
argumentString is documented here and in the test. Be sure to use nested or escaped quotes when necessary in the
argumentString. The callback contains
err is null if no erros were encountered when calling tasklist.exe with the supplied
processString is a table, list, or CSV string of information about a matched process or processes, depending on the supplied
argumentString. Choosing CSV and using node-csv is an easy way to deal with the resulting data.
This convenience method is equivalent to
Search for a given
pidOrProcessName. Both string and numeric PIDs are supported.
err is null if one or more processes were found.
processes is an object which contains information (process name, PID, session name, session number, and memory usage) about a matched process or processes. It has two properties,
array (an array of arrays) and
object (an array of objects). The properties of
memUsage. For example, to find the memory usage of the first process found, you could use
Search for one or more PIDs that match a given
err is null if one or more PIDs were found.
processes is an array of matched PIDs.
Search for the
processName that corresponds with the supplied integer or string
Err is null if a process name was found.
Kill a given process name or PID (
proc). The callback is optional, and
err is null if no erros were encountered when calling taskkill.exe with the supplied
proc. If a process name is passed for
proc, and multiple matches are found, all of the matches are killed.