Вопрос

Colls, hello. My javascript run an external .bat file:

var objShell = new ActiveXObject("Shell.Application");
        objShell.ShellExecute("start.bat", "Main.bat c:\pr  ext.dat ", "C:\\PR\\", "open", "1");

Start.bat file works five minutes. And after that my script continue execute other commands. My question is «how to ask (let him know) javascript to wait an end of executing Start.bat file?»

The naxt code is not very suitable in my case:

var date = new Date();
var curDate = null;

do { curDate = new Date(); } 
while(curDate-date < millis);
Это было полезно?

Решение

If you're sure about the time your Main.bat needs to execute, you can use this:

WScript.Sleep(50000);

WSH Language reference: http://msdn.microsoft.com/en-us/library/98591fh7(v=vs.84).aspx

Sleep method: http://msdn.microsoft.com/en-us/library/6t81adfd(v=vs.84).aspx

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top