簡體   English   中英

Node.js exec無法正常工作

[英]Nodejs exec is not working

我正在使用exec執行一些DOS命令:

java -jar D:\selenium\selenium-server-standalone-2.40.0.jar -htmlSuite "*firefox3 C:\Users\AppData\Local\Mozilla Firefox\firefox.exe" "http://google.com" "D:\selenium\TS2.html" "D:\selenium\Res3.html"

喜歡

exec(['java','-jar','D:/selenium/selenium-server-standalone-2.40.0.jar','-htmlSuite','"*firefox3','C:/Users/AppData/Local/Mozilla Firefox/firefox.exe"','"http://google.com"','"D:/selenium/TS2.html"','"D:/selenium/Res3.html"'], function(err, out, code) {

});

顯示錯誤為

HTML suite exception seen:
java.io.IOException: The filename, directory name, or volume label syntax is incorrect

請幫助我執行此命令,謝謝:)

-htmlSuite參數的值分為兩部分。

而且您可能應該在路徑名中使用反斜杠( 因為您使用的是dos / win ):

  exec(['java','-jar','D:\\\\selenium\\\\selenium-server-standalone-2.40.0.jar','-htmlSuite','"*firefox3 C:\\\\Users\\\\AppData\\\\Local\\\\Mozilla Firefox\\\\firefox.exe"','"http://google.com"','"D:\\\\selenium\\\\TS2.html"','"D:\\\\selenium\\\\Res3.html"'], function(err, out, code) { }); 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM