Count down timer

August 26, 2010 at 06:55:03
Specs: Windows XP
I know everyone has seen at least once, a count down timer. Counting down the days, hours, minutes, seconds, etc till a specific date.


Possible in batch???


See More: Count down timer

Report •


#1
August 29, 2010 at 08:08:19
This will work on vista and windows 7. If you don't have that you will need to replace the "TIMEOUT /t 1" with "PING /n 2". (PING is less accurate).

@ECHO OFF

:Setup

SET /p Days=Days:
SET /p Hours=Hours:
SET /p Minutes=Minutes:
SET /p Seconds=Seconds:

:Countdown

CLS
ECHO   %Days%  -  %Hours%  -  %Minutes%  -  %Seconds%
ECHO Days  Hours  Mins  Secs

TIMEOUT /t 1 >Nul

IF "%Seconds%"=="0" (
	IF "%Minutes%"=="0" (
		IF "%Hours%"=="0" (
			IF "%Days%"=="0" (
				GOTO Done
			)
			SET /a Days -=1
			SET Hours=24
		)
		SET /a Hours -=1
		SET Minutes=60
	)
	SET /a Minutes -=1
	SET Seconds=60
)

SET /a Seconds -=1
GOTO Countdown

:Done

CLS
ECHO Times Up!
ECHO.
PAUSE


Report •

#2
August 29, 2010 at 08:46:33
Can there be a preset time so that ever time a user runs the batch, it will know that its so many days/hours/minutes/seconds from that very day that was preset in the batch?

Report •

#3
August 29, 2010 at 09:20:43
Uhm.. I can't think of a way right now, I'll ponder it for a while and get back to you.

Report •

Related Solutions


Ask Question