Ich benutze node.js v4.4.4 und ich muss eine .bat
Datei von node.js ausführen. Kommandozeile mit folgendem Pfad (Fenster-Plattform)Wie führe ich eine .bat Datei von node.js aus, die einige Parameter übergibt?
Von dem Standort der js-Datei für meine Knoten App, die .bat runnable ist:
'../src/util/buildscripts/build.bat --profile ../profiles/app.profile.js'
Aber wenn der Knoten mit Ich kann es nicht laufen, keine spezifischen Fehler werden ausgelöst.
Was mache ich hier falsch?
var ls = spawn('cmd.exe', ['../src/util/buildscripts', 'build.bat', '--profile ../profiles/app.profile.js']);
ls.stdout.on('data', function (data) {
console.log('stdout: ' + data);
});
ls.stderr.on('data', function (data) {
console.log('stderr: ' + data);
});
ls.on('exit', function (code) {
console.log('child process exited with code ' + code);
});
Verwandte: https://nodejs.org/api/child_process.html#child_process_spawning_bat_and_cmd_files_on_windows – GibboK
Related : https://medium.com/@graeme_boy/how-to-optimize-cpu-intensive-work-in-node-js-cdc09099ed41#.zbzjytwzw – GibboK