M. Plezsen
M. Plezsen

Reputation: 21

How to run a powershell script from javascript?

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

Answers (1)

UchihaItachi
UchihaItachi

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

Related Questions