Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to run an executable with commandline?

4 views
Skip to first unread message

Daniel Kirsch

unread,
Feb 25, 2004, 1:21:36 PM2/25/04
to
[win32]

Hi,
how can I run any executable with an additional commandline parameter
using XPCOM? Is there any build in method? I want to start an
application and pass an argument. Something like

SERVICE.run("notepad.exe","c:\\temp\\computer.txt");

Thanks
Daniel

Darin Fisher

unread,
Feb 25, 2004, 3:15:45 PM2/25/04
to
Daniel Kirsch wrote:

> _______________________________________________
> Mozilla-xpcom mailing list
> Mozill...@mozilla.org
> http://mail.mozilla.org/listinfo/mozilla-xpcom


see nsIProcess:

http://lxr.mozilla.org/mozilla/search?string=nsIProcess

-darin

Christian Biesinger

unread,
Feb 25, 2004, 5:41:20 PM2/25/04
to
Daniel Kirsch wrote:
> how can I run any executable with an additional commandline parameter
> using XPCOM?

Use nsIProcess:
http://lxr.mozilla.org/seamonkey/source/xpcom/threads/nsIProcess.idl

For example in js code:

/* file is an nsIFile pointing to the executable */
var proc =
Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
proc.init(file);
proc.run(false, ["argument1", "argument2"], 2);

Daniel Kirsch

unread,
Feb 26, 2004, 4:01:41 AM2/26/04
to
Christian Biesinger wrote:
> Use nsIProcess:
> http://lxr.mozilla.org/seamonkey/source/xpcom/threads/nsIProcess.idl

Thanks a lot
Daniel

0 new messages