Click to See Complete Forum and Search --> : Put a delay in a batch job?
beach101
July 17th, 2001, 02:03 PM
Ok, it's been a long time since I wrote a DOS batch job and I could have sworn that there was a 'wait' command? Need to introduce a delay before executing a command. Any ideas?
Thanks for your help.
shamus
July 17th, 2001, 02:46 PM
I think 'pause' would do the trick...
MacGyver
July 17th, 2001, 05:51 PM
Pause won't work, it only waits for user to strike a key before continuing.
What you need is this:
choice /n/t:c,25/c:cc
Basically the CHOICE command is used to accept menu choices in a batch file. If the user doesn't select an option, you can have it automatically choose an option.
In this case, we don't have any options and are basically only using the timer. You can have whatever delay you want (in seconds) just change the number in the command above to whatever you need.
DR
July 17th, 2001, 06:15 PM
I have found this site to be helpful in writing batch files. http://www.computerhope.com
This link leads to a page describing how to write a batch file delay. I'm not sure this fits your case. It read like it delayed the start of the run. It does give a good example of the CHOICE command at top of page. http://www.computerhope.com/batch.htm#4
They also have some useful utilities. One changes BAT files to COM files. The Tech guide is full of helpful tips and guides on how to write what you want.
beach101
July 18th, 2001, 10:57 AM
I never would have thought of the Choice command. Brilliant. You guys are great. Thanks. <IMG SRC="smilies/smile.gif" border="0">
Gabriel
July 21st, 2001, 11:39 PM
Originally posted by MacGyver:
<STRONG>Pause won't work, it only waits for user to strike a key before continuing.
What you need is this:
choice /n/t:c,25/c:cc
Basically the CHOICE command is used to accept menu choices in a batch file. If the user doesn't select an option, you can have it automatically choose an option.
In this case, we don't have any options and are basically only using the timer. You can have whatever delay you want (in seconds) just change the number in the command above to whatever you need.</STRONG>
is there any similar to NT4 Command Prompt?
Outcoded
July 22nd, 2001, 05:44 AM
dir c:\ /s > nul
dir c:\ /s > nul
dir c:\ /s > nul
dir c:\ /s > nul
dir c:\ /s > nul
dir c:\ /s > nul
dir c:\ /s > nul
dir c:\ /s > nul
dir c:\ /s > nul
dir c:\ /s > nul
dir c:\ /s > nul
That oughta slow it down a bit <IMG SRC="smilies/biggrin.gif" border="0">
Penman
July 23rd, 2001, 01:26 PM
Following command should stop the computer for 5 seconds, you can increase it up to 99
I think (been a while!)
TYPE NUL | CHOICE.COM /N /CY /TY,5 >NUL
windrivers.com
Copyright 2007 Jupitermedia Corporation All Rights Reserved.