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