Using NodeJS I want to get a list of open applications on Windows.
Something along the lines of:
exec("tasklist", function (error, stdout, stderr) {
for(var i=0;i<stdout.length;i++)
{
if( stdout[i]['name'].indexOf('ll_') > -1 )
{
appList.push({'id':stdout[i]['id'],'name':stdout[i]['name']});
}
}
});
Where appList
is an object of running applications with their ID and Name if they start with ll_
.
How can I do this?
In windows you can simply go to the Task Manager and check for node in the application list. If it is there then it is running in the machine. There is no default page or URL that node server provides from which you can know that node is running on that server by using the Public IP address or domain name.
Node. js runs on chrome v8 engine which converts javascript code into machine code, it is highly scalable, lightweight, fast, and data-intensive. Working of Node.
(I don't run Windows, so the following is untested)
First, install tasklist
:
$ npm install tasklist
Then, use the following script:
var tasklist = require('tasklist');
tasklist(function(err, tasks) {
if (err) throw err; // TODO: proper error handling
var appList = tasks.filter(function(task) {
return task.imageName.indexOf('ll_') === 0;
}).map(function(task) {
return {
id : task.pid, // XXX: is that the same as your `id`?
name : task.imageName,
};
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With