Shoutbox

ShellExecute program with parameters - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: ShellExecute program with parameters (/showthread.php?tid=71631)

ShellExecute program with parameters by tommy87xxx on 02-11-2007 at 05:33 PM

Hi, I don't speak english very well but I need an information.
For run an external application I do this:

code:
var objShell = new ActiveXObject("Shell.Application");
objShell.ShellExecute('C:\app.exe');

But my application must be execute with some parameters... I write this:

code:
var objShell = new ActiveXObject("Shell.Application");
objShell.ShellExecute('C:\app.exe param1 param2');

but the function return error because search the 'C:\app.exe param1 param2' file that don't exist naturally.

Do someone help me, please?
RE: ShellExecute program with parameters by deAd on 02-11-2007 at 05:47 PM

You must escape the backslashes.

code:
var objShell = new ActiveXObject("Shell.Application");
objShell.ShellExecute('C:\\app.exe param1 param2');

EDIT: MyBB won't display it properly? fixed..
RE: ShellExecute program with parameters by vikke on 02-11-2007 at 05:49 PM

Use the ShellExecute API instead, like this:

code:
Interop.Call("shell32.dll", "ShellExecuteW", null, "open", "C:app.exe", "param1 param2", "", SW_SHOWDEFAULT)
quote:
Originally posted by deAd
You must escape the backslashes.

code:
var objShell = new ActiveXObject("Shell.Application");
objShell.ShellExecute('C:app.exe param1 param2');

EDIT: MyBB won't display it properly? fixed..
You're showing the same code :).
I think you mean:
code:
objShell.ShellExecute("C:\app.exe param1 param2");

RE: ShellExecute program with parameters by tommy87xxx on 02-11-2007 at 05:59 PM

Good! Thanks vikke, your function works more good!!!


RE: RE: ShellExecute program with parameters by deAd on 02-11-2007 at 06:02 PM

quote:
Originally posted by vikke
You're showing the same code :).
I think you mean:
code:
objShell.ShellExecute("C:app.exe param1 param2");

No, I had the backslash escaped, but it might not have shown properly since MyBB seems to be messing with that :P
RE: ShellExecute program with parameters by vikke on 02-11-2007 at 06:14 PM

Yeah lol, it removed mine too, two // becomes one