http://blog.csdn.net/jensonhjt/article/details/1765557
<Script>
functionHello (){
Netscape.security.PrivilegeManager.enablePrivilege ( " universalxpconnect " );
var &NBSP;FILE&NBSP; = components.classes[ " @mozilla. org/file/local;1 " ].createinstance (Components.interfaces.nsILocalFile);
file.initwithpath ( " d:/ Program files/foobar2000/foobar2000.exe " file.launch ();
}
Script>
The above code executes the program without parameters, and the following code executes the program with the parameter added.
functionHello (){
varOurl= "www.baidu.com";
Netscape.security.PrivilegeManager.enablePrivilege ("Universalxpconnect");
varProcess=components.classes['@mozilla. Org/process/util;1'].getservice (Components.interfaces.nsIProcess);
varTargetFile=components.classes['@mozilla. Org/file/local;1'].createinstance (Components.interfaces.nsILocalFile);
Targetfile.initwithpath ("D:/temp/1.exe");
Process.init (targetfile);
vararguments=[Ourl]; //The arguments parameter must be an array, otherwise the following statement does not execute
Process.run (false, arguments, Arguments.length,{});
}
Read (2904) | Comments (0) | Forwards (0) |0
Previous: JavaScript call EXE program (Windows) Pass parameters
Next: Use JS to determine the browser type (IE,FIREFOX)
Related Popular articles
- Tracing memory leaks with process information ...
- Webcam Avcodec_encode_video2 ...
- Make multi-version Fedora system installation U ...
- Three ways to call system under Linux ...
- Could not find a part of the ...
- About SSI
- IP Sec VPN and Nat reunion
- JS Analog Mouse Auto Click
- UT2.0 official version download
- tomcat6.0 configuration (with configuration video download ...
- Linux DHCP Peizhi ROC
- Soft links to Unix files
- What does this command mean, I'm new ...
- What does sed-e "/grep/d" mean ...
- Who can help me solve Linux 2.6 10 ...
Leave something to the owner! ~~ Comment on the hot topic
Use JavaScript to invoke local programs in Firefox