What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » ShellExecute program with parameters

ShellExecute program with parameters
Author: Message:
tommy87xxx
New Member
*


Posts: 2
Joined: Feb 2007
O.P. ShellExecute program with parameters
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?
02-11-2007 05:33 PM
Profile E-Mail PM Find Quote Report
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
RE: ShellExecute program with parameters
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..

This post was edited on 02-11-2007 at 05:49 PM by deAd.
02-11-2007 05:47 PM
Profile PM Find Quote Report
vikke
Senior Member
****

Avatar

Posts: 900
Reputation: 28
31 / Male / Flag
Joined: May 2006
RE: ShellExecute program with parameters
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");

This post was edited on 02-11-2007 at 05:50 PM by vikke.
02-11-2007 05:49 PM
Profile E-Mail PM Find Quote Report
tommy87xxx
New Member
*


Posts: 2
Joined: Feb 2007
O.P. RE: ShellExecute program with parameters
Good! Thanks vikke, your function works more good!!!
02-11-2007 05:59 PM
Profile E-Mail PM Find Quote Report
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
RE: RE: ShellExecute program with parameters
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
02-11-2007 06:02 PM
Profile PM Find Quote Report
vikke
Senior Member
****

Avatar

Posts: 900
Reputation: 28
31 / Male / Flag
Joined: May 2006
RE: ShellExecute program with parameters
Yeah lol, it removed mine too, two // becomes one
02-11-2007 06:14 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On