Xinus
Xinus

Reputation: 30553

How to call bat file present inside firefox extension content directory

I have a bat file which needs to be called from javascript in firefox extension ..

I have bat file present in content/chrome directory.. I tried to call bat file like this ..

var exe = 

Components.classes['@mozilla.org/file/local;1']
          .createInstance(Components.interfaces.nsILocalFile);
exe.initWithPath("chrome://sample/content/test.bat");
exe.launch();

But it's not working ..

Upvotes: 1

Views: 1900

Answers (1)

Ted Mielczarek
Ted Mielczarek

Reputation: 3967

You'll want to use the nsIProcess interface: https://developer.mozilla.org/en/Code_snippets/Running_applications#Using_nsIProcess

I've used this with batch files before successfully.

(Specifically, here: http://code.google.com/p/extensiondev/source/browse/trunk/content/extensionbuilder.js#915 although some of that code may be out of date!)

Upvotes: 3

Related Questions