You are not logged in.
I know that there is the timeout command, but it is available only on Windows 10. I can also delay my batch file using ping like this:
ping localhost -n 5 >nul
But it will depend on the computer speed. Is there any more sure method that works on Windows 7?
Last edited by Manna5 (19 Mar 2021 19:19)
Offline
Windows 7 is no longer safe
https://securityboulevard.com/2020/04/n … -in-sight/
How to upgrade from Windows 7 to Windows 10 for free
https://www.theverge.com/2020/1/14/2106 … 10-free-os
Offline
Thanks, but I had Windows 10 and it was too glitchy for me, and I downgraded to Windows 7. Also, if I later publish my batch file, its users may have not got Windows 10.
Last edited by Manna5 (20 Mar 2021 10:52)
Offline
As mentioned by Simon, Windows 7 is well out of support and thus I'd strongly caution against using it in any environment that is not entirely sandboxed from the web.
That said, here are some potential alternatives to `ping`, with caveats attached.
https://ss64.com/nt/timeout.html -- seems like it uses clock second boundaries, so a bad option if accuracy of the interval is of a concern to you as you imply.
https://ss64.com/nt/choice.html -- this would be a misuse, may not work in non-interactive scenarios; in interactive scenarios a user could press a key to hurry things along.
https://ss64.com/nt/waitfor.html -- another misuse, wait for a signal that never comes and timeout at the requested interval (I've never tried this one so it might not be suitable for some reason).
You're going to have to try these out for yourself to see if they address your accuracy concerns.
As for your objection to ping, I'm not sure how much of a variation you might be expecting based on computer speed, I'll defer to your knowledge of your environment on this.
If accuracy is your chief concern, and high processor usage is not an issue, you could write something in batch that inspects the clock repeatedly to wait for the desired amount of time to pass, but this would be a pretty nasty solution.
Last edited by bluesxman (23 Mar 2021 10:18)
cmd | *sh | ruby | chef
Offline
"I know that there is the timeout command, but it is available only on Windows 10. ... Is there any more sure method that works on Windows 7?"
TimeOut is also available in Windows 7.
Whatever has made you think otherwise is incorrect.
Denis
Last edited by Try3 (22 Mar 2021 09:18)
Offline
Try3: Really, it works on 7. When it was not working, I was propably working on XP (I have got 2 computers).
Offline