0
我正嘗試在使用網絡路徑的電子中運行批處理文件。我使用的功能是:電子 - 無法找到網絡路徑
function cpSixHundred() {
require('child_process').exec("file:\\\\LSC-SA-NAS1\\Departments\\Information Technology\\Software\\Zebra Label Printer Reset Counters", function(err, stdout, stderr) {
if (err) {
// Ooops.
// console.log(stderr);
return console.log(err);
}
// Done.
console.log(stdout);
});
}
我得到的錯誤是:
Error: Command failed: \\LSC-SA-NAS1\Departments\Information
Technology\Software\Zebra Label Printer Reset Counterstest.bat
'\\LSC-SA-NAS1\Departments\Information' is not recognized as an internal or
external command,
operable program or batch file.
我的理解是不喜歡在網絡路徑的空間。我已經嘗試了許多引號和字符串連接的組合,但仍然沒有運氣。
預先感謝您。
這個問題看起來很相似。也許不是,但值得一看:https://stackoverflow.com/questions/16395612/unable-to-execute-child-process-exec-when-path-has-spaces – Aaron