The recommended way is to use the
nsIProcess interface because it is crossplatform.
nsILocalFile.launch()for details and make sure that all your target platforms support this method!
This method has the same effect as if you double-clicked the file, so for executable files—it will just run the file without any parameters.
var file = Components.classes["@mozilla.org/file/local;1"] .createInstance(Components.interfaces.nsILocalFile); file.initWithPath("c:\\myapp.exe"); file.launch();
- If you need to launch an executable bundled in your XPI, see Code snippets:File I/O#Getting your extension's folder.
- Launching an executable process from a web page