I'm working with nodejs and the child process module to execute commands on my platform. To do that, I use the spawn function.
Here's my code:
var spawn_execution = executor.spawn(command, args);
spawn_execution.stdout.on('data', function (data) {
console.log('stdout: ' + data);
});
spawn_execution.stderr.on('data', function (data) {
console.log('stderr: ' + data);
});
Nothing fancy. So I tried a couple of commands that worked like
executor.spawn('C:/path/to/ffmpeg.exe', [...]);
But when I try to use a native windows command, it does not work. For instance, I tried:
executor.spawn('del', ['C:\\my\\file\\to\\delete']);
When executing this, I've got a ENOENT error which means that the file is not found. So I did another thing:
executor.spawn('C:/my/script-delete.exe', ['C:\\my\\file\\to\\delete']);
This script-delete.exe just contains:
del %1
So why does the spawn function need to have a script file? Why does it not work with native windows command? Do you know a way to make it work with a native command?
Thank you!