const child_process = require('child_process');
const dir = child_process.spawn('dir');
dir.stdout.on('data', (data) => {
console.log(data);
});
dir.stderr.on('data', (data) => {
console.log(data);
});
dir.on('close', (code) => {
console.log(code);
});
dir.on('error', (err) => {
console.log(`Error: ${err}`);
});
const child_process = require('child_process');
const ch = child_process.spawn('test.bat', [], {
shell: true,
})
ch.stdout.on('data', (data) => {
console.log(`Stdout: ${data}`);
});
ch.stderr.on('data', (data) => {
//console.log(`Stderr: ${data}`);
});
ch.on('close', (code) => {
//console.log(`Code: ${code}`);
});
ch.on('error', (err) => {
//console.log(`Error: ${err}`);
});