I am trying to call an exe file from the node.js with 3 parameters. Getting error as
errno: 'ENOENT'
code: 'ENOENT'
I am using 64 bit windows 10 system. Here is the code that i am using currently
var exec = require('child_process').execFile;
var opt =function(){
exec('file.EXE arg1 arg2 arg3', function(err, data) {
console.log(err)
console.log(data.toString());
});
}
opt();
You need to separate file name and arguments .
Syntax: child_process.execFile(file[, args][, options][, callback])
var exec = require('child_process').execFile;
var opt = function(){
exec('file.EXE', ["arg1", "arg2", "arg3"], function(err, data) {
console.log(err)
console.log(data.toString());
});
}
opt();
In the following example, I'm compiling Main.java using javac.exe.
here file name is javac.exe path and Main.java is argument.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.