PDA

View Full Version : Launch an application in Javascript



locbtran
03-25-2010, 07:22 PM
If I want to launch an application in DOS, it is START notepad.exe

How do I launch an application in javascript?


thanks

locbtran
03-29-2010, 11:54 PM
I'm only using this on my local host and not on the internet. I tried something like this, it works for notepad or calc.


var WshShell = new ActiveXObject("WScript.Shell");
WshShell.Exec("notepad.exe");


It does not work if I launch a non built in MS application.


var WshShell = new ActiveXObject("WScript.Shell");
WshShell.Exec("d:\hjsplit.exe");



Any comments or suggestions is greatly

jscheuer1
03-30-2010, 09:57 AM
That's (highlighted) a string and the \ is the escape character, so:



WshShell.Exec("d:\hjsplit.exe");

looks like:


WshShell.Exec("d:hjsplit.exe");

to the browser. Just escape the escape:


var WshShell = new ActiveXObject("WScript.Shell");
WshShell.Exec("d:\\hjsplit.exe");