I have a batch script that is executed outside of an interactive command prompt. I want to sleep for 30 seconds between two commands in it?
I've read in some responses to similar questions that you can use timeout or choice, but these fail in a non-interactive session.
ERROR: Input redirection is not supported, exiting the process immediately.
I've read in other responses to similar questions that you can use waitfor, but this will set an error level and I rely on those in the overall script.
I've seen using a ping that will fail ping -n 1 -w 30000 192.168.not.reachable > NUL and this appears to work, but that just seems wrong and I can't rely on an single IP being not reachable on all systems I'll deploy to.
Is there another way for me to try?
Thanks.
EDITS:
This answer (How to sleep in a batch file?) definitely has related material, but doesn't address the need for a solution that works outside an interactive shell. It does mention the only alternative I have now: ping, but as I ask above, I'm looking for alternatives.
Also, thanks for the PowerShell suggestions, but that's not possible now.
ping -n 30 127.0.0.1. It's still silly, using PS would be the more modern alternative. – Sven Aug 30 '16 at 00:37192.0.2.0/24is still silly. – Sven Aug 30 '16 at 00:43-n 30improvement. At least then the silly hack is portable to all deployments. I gather there's nothing "not silly" available for this? – Jobu Aug 30 '16 at 04:06timeout /t 30 /nobreakAdditionally, if you don't want the command to print its countdown on the screen, you can redirect its output to NUL:
– Jeter-work Aug 30 '16 at 17:14timeout /t 30 /nobreak > NUL