Page 1 of 1

Timing a command

Posted: 07 Jul 2010 01:21
by Draginz
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?

Re: Timing a command

Posted: 07 Jul 2010 10:58
by aGerman
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

Re: Timing a command

Posted: 07 Jul 2010 17:24
by Draginz
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!