Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
35
rated 0 times [  39] [ 4]  / answers: 1 / hits: 108842  / 11 Years ago, mon, november 4, 2013, 12:00:00

I don't know how to execute an exe file in node.js. Here is the code I am using. It is not working and doesn't print anything. Is there any possible way to execute an exe file using the command line?



var fun = function() {
console.log(rrrr);
exec('CALL hai.exe', function(err, data) {

console.log(err)
console.log(data.toString());
});
}
fun();

More From » node.js

 Answers
14

you can try execFile function of child process modules in node.js



Refer:
http://nodejs.org/api/child_process.html#child_process_child_process_execfile_file_args_options_callback



You code should look something like:



var exec = require('child_process').execFile;

var fun =function(){
console.log(fun() start);
exec('HelloJithin.exe', function(err, data) {
console.log(err)
console.log(data.toString());
});
}
fun();

[#74530] Friday, November 1, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
brooksb

Total Points: 480
Total Questions: 98
Total Answers: 106

Location: Somalia
Member since Mon, Feb 27, 2023
1 Year ago
;