我正在这样做,但是它永远不会停止等待。
var oExec = WshShell.Exec('powershell -executionpolicy bypass -File "C:\\split.ps1" "'+inFolder+'\\'+sf.name+'" "'+outFolder+'"');
while(oExec.Status == 0)
{
doOut("Waiting for command to finish")
WScript.Sleep(100);
}
编辑: 通过反复试验,我设法创建了它并且起作用了。
var command = 'powershell -ExecutionPolicy ByPass -Command "& \'C:\\split.ps1\'';
WshShell.Exec(command);
while(oExec.Status == 0)
{
doOut("Waiting for command to finish")
WScript.Sleep(100);
}
,这有效。我无需执行任何操作来增强脚本功能。它的尽头没有出口。