Time the execution of batch file commands of VB scripts without using WScript.sleep <p>I have a batch file which starts telnet server and stops telnet server with sleep time in between. </p> <p><strong>Script:</strong></p> <pre><code>set OBJECT=WScript.CreateObject("WScript.Shell") WScript.sleep 5000 OBJECT.SendKeys "net stop TlntSvr{ENTER}" WScript.sleep 30000 OBJECT.SendKeys "net start TlntSvr{ENTER}" WScript.sleep 30000 OBJECT.SendKeys "exit" </code></pre> <p>Like you see the above code stops <em>telnet services</em> using <code>net stop TlntSvr</code> and then starts telnet services using <code>net start TlntSvr</code> with a sleep time in between like <code>WScript.sleep 3000</code>. </p> <p><strong>Issue:</strong> Now I need to run <strong>this batch file</strong> in multiple systems PCs/laptop and in each execution cases, the time taken to start/stop <em>telnet services/telnet service installation</em> varies and hence I had to <strong>modify the sleep time every time</strong> when I am running the script in different systems. </p> <p><strong>Question:</strong> Is there a way to time the next execution such that as soon as the first execution completes only then it will start the next execution? Meaning I don't need to configure the sleep time for each laptops/PCS, the next execution will start only when the first execution is over according to each PC's own execution behavior. </p>