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