2010-09-06 66 views
1

我使用下面的JavaScript:如何寫一個DOS命令編寫一個批處理文件中爲一個javascript

function doPrint(){ 
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); 
var exe = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile); 
exe.initWithPath("C:\\temp\\print.bat"); 
exe.launch(); 
} 

print.bat具有以下命令:

lpr -S 192.168.19.211 -P print -o l C:\\Temp\\temp.txt 

代碼運行正常,但它需要print.bat存在。

如何將print.bat中寫入的命令轉換爲我的doPrint函數?

回答

相關問題