Reputation: 21
Can you help me with a javascript to run a powershell script? The both files are on the same local machine.
Upvotes: 2
Views: 5954
Reputation: 2742
I assume you are referring to server side javascript(node.js)
you can use .exec()
function in the child_process
module . eg
require('child_process').exec('ls',
function (err, stdout, stderr) {
console.log( stdout);
if (err) {
console.log('Error ' + err);
}
});
will run the ls
command
Upvotes: 1