computing
  • 0

Count Down Timer

  • 0

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???

Share

0 Answers

  1. 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

    • 0