Be a Supporter!

Batch File Timer

  • 519 Views
  • 6 Replies
New Topic Respond to this Topic
cafdrew
cafdrew
  • Member since: Mar. 29, 2005
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Batch File Timer 2006-11-02 20:00:11 Reply

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
Response to Batch File Timer 2006-11-03 01:52:46 Reply

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
Response to Batch File Timer 2006-11-03 08:49:18 Reply

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
Response to Batch File Timer 2006-11-03 10:03:15 Reply

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
Response to Batch File Timer 2006-11-03 23:03:02 Reply

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
Response to Batch File Timer 2006-11-03 23:44:20 Reply

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

BBS Signature
Jordan
Jordan
  • Member since: Apr. 23, 2006
  • Offline.
Forum Stats
Member
Level 14
Blank Slate
Response to Batch File Timer 2006-11-04 03:39:08 Reply

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.