Here is my code for running exe using javascript. It's working fine. Is there a way for me to know:
Also, what is the difference between using ShellExecute & Run?
var sExePath = "c:\\Debug\\WebToCardReader_Test.exe";
var oShell = new ActiveXObject("Shell.Application");
var oExec = oShell.ShellExecute(sExePath, "", "", "open", "1");
Run
allows you to set the boolean bWaitOnReturn
flag, which blocks your script until the program returns.
On that page, the VBScript sample simply assigns the command to a variable (as you've done with ShellExecute
). I'm not sure if this works in JavaScript, but it's worth a shot.
However, as you know, ShellExecute
does allow you to store a return value.