Timing a command

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Draginz
Posts: 7
Joined: 07 Jul 2010 00:53

Timing a command

#1 Post by Draginz » 07 Jul 2010 01:21

So I need help with timing something.
I need to do this basically:
color 4
time 10 /This is where the timing command would go
color 6 /after ten seconds passed, it would execute the next command.
So is there a command to do this or does it involve some sort of elaborate vacuum tube system?

Oh, and while I'm here, I might as well ask is there a batch command to open a CD drive?

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Timing a command

#2 Post by aGerman » 07 Jul 2010 10:58

There is no "wait" command in native batch. Most use the ping command.

Code: Select all

@echo off &setlocal
color 4
echo Wait 10 seconds.

ping -n 11 localhost>nul

color 6
echo 10 seconds are gone.
pause>nul

number of pings = waiting time + 1


There is no command to open/close a CD/DVD drive.

Regards
aGerman

Draginz
Posts: 7
Joined: 07 Jul 2010 00:53

Re: Timing a command

#3 Post by Draginz » 07 Jul 2010 17:24

aGerman wrote:There is no "wait" command in native batch. Most use the ping command.

Code: Select all

@echo off &setlocal
color 4
echo Wait 10 seconds.

ping -n 11 localhost>nul

color 6
echo 10 seconds are gone.
pause>nul

number of pings = waiting time + 1


There is no command to open/close a CD/DVD drive.

Regards
aGerman


Thanks, that's very helpful!

Post Reply