I create a b.js script file like below. when i run this using node.exe program then it correctly open "word2code.exe" file. How can i add this script in a .html page (as link or button onclick event) in appjs for windows?
var exec = require('child_process').execFile;
var fun =function(){
console.log("fun() start");
exec('word2code.exe', function(err, data) {
console.log(err)
console.log(data.toString());
});
}
fun();
You cannot run an exe directly on the client side in an HTML page -- the browser cannot understand binaries. Instead, if you basically want to fire off a process like this, you could take another approach:
By doing things this way, you're essentially allowing a web user to run an exe indirectly (your server will be the one running the binary, not the user).