I am trying to run commands on Windows via NodeJS child processes:
var terminal = require(\'child_process\').spawn(\'cmd\');
terminal.stdout.on(\'data\', fu
You can use child_process exec method. here is an example:
var exec = require('child_process').exec,
child;
child = exec('echo %PATH%',
function (error, stdout, stderr) {
if(stdout!==''){
console.log('---------stdout: ---------\n' + stdout);
}
if(stderr!==''){
console.log('---------stderr: ---------\n' + stderr);
}
if (error !== null) {
console.log('---------exec error: ---------\n[' + error+']');
}
});