Batch File Timer
- cafdrew
-
cafdrew
- Member since: Mar. 29, 2005
- Offline.
-
- Forum Stats
- Member
- Level 08
- Blank Slate
I have a batch file that does a few things. I want have a countdown or some sort of timer and when it finishes the rest of the batch file will continue.
I've tried searching google and had no luck.
Does anybody know anything about this?
Thanks!
- Jordan
-
Jordan
- Member since: Apr. 23, 2006
- Offline.
-
- Forum Stats
- Member
- Level 14
- Blank Slate
sleep or timeout.
SLEEP 10
will delay execution of the next command by 10 seconds.
TIMEOUT 10
will delay execution of the next command by 10 seconds, or continue immediately when a key is pressed before those 10 seconds expire.
- cafdrew
-
cafdrew
- Member since: Mar. 29, 2005
- Offline.
-
- Forum Stats
- Member
- Level 08
- Blank Slate
At 11/3/06 01:52 AM, Jordan wrote: sleep or timeout.
SLEEP 10
will delay execution of the next command by 10 seconds.
TIMEOUT 10
will delay execution of the next command by 10 seconds, or continue immediately when a key is pressed before those 10 seconds expire.
Both of those commands do not work.
Any other suggestions?
- Jordan
-
Jordan
- Member since: Apr. 23, 2006
- Offline.
-
- Forum Stats
- Member
- Level 14
- Blank Slate
Yes they do:
@echo off
echo Hello
sleep 10
echo hahaha, see?
pause
- cafdrew
-
cafdrew
- Member since: Mar. 29, 2005
- Offline.
-
- Forum Stats
- Member
- Level 08
- Blank Slate
At 11/3/06 10:03 AM, Jordan wrote: Yes they do:
@echo off
echo Hello
sleep 10
echo hahaha, see?
pause
'sleep' is not a recognized as an internal or external command, operable program or batch file.
It doesn't work.
- amaterasu
-
amaterasu
- Member since: Mar. 7, 2004
- Offline.
-
- Forum Stats
- Member
- Level 08
- Blank Slate
What you can do is write (or ask someone here nicely and they might write it for you) a quick executable that the batch file would call. You could have the starting input as an integer telling it how long to pause, the program would run for however many seconds, and then once it terminates, the batch file would continue.
Like this:
do stuff
do stuff
sleep.exe 20
do more stuff after 20 seconds
beep
- Jordan
-
Jordan
- Member since: Apr. 23, 2006
- Offline.
-
- Forum Stats
- Member
- Level 14
- Blank Slate
At 11/3/06 11:03 PM, cafdrew wrote: It doesn't work.
Well, it does for me and some people i asked on MSN.
Try amaterasu's idea, shouldn't be too hard.

