Timer in Batch/CMD

by MihaiPopa9 in Design > Software

13 Views, 0 Favorites, 0 Comments

Timer in Batch/CMD

Untitled.png

How to create a timer! Just in Windows Batch

Supplies

Any Windows OS that has CMD

Work for code

Code

Just code:


@echo off

title Timer

:choosetheme

echo Choose your theme!!

echo 1. Light

echo 2. Dark

echo 3. Martix

set /p theme=Choose

if %theme% EQU 1 goto lighttheme

if %theme% EQU 2 goto darktheme

if %theme% EQU 3 goto martixtheme

:lighttheme

color F0

echo Enter your time here!

set /p time=Enter

goto timer

:timer

cls

echo Your time is [%time% seconds]

if %time%==0 goto timeup

ping /n 2 localhost >nul

set /a time=%time%-1

goto timer

if %time%==0 goto timeup

:darktheme

color 0F

echo Enter your time here!

set /p time2=Enter

goto timer2

:timer2

cls

echo Your time is [%time2% seconds]

if %time2%==0 goto timeup2

ping /n 2 localhost >nul

set /a time2=%time2%-1

goto timer2

:timeup

echo Your time is up!!

pause >nul

goto start

:timeup2

echo Your time is up!!

pause >nul

goto start

:timeup3

echo Your time is up!!

pause >nul

goto start

:martixtheme

color 0A

echo Enter your time here!

set /p time3=Enter

goto timer3

:timer3

cls

echo Your time is [%time3% seconds]

if %time3%==0 goto timeup3

ping /n 2 localhost >nul

set /a time3=%time3%-1

goto timer3


I have the source code ready for download!

Just click on the "Batch Timer Source Code.txt" to download!

Save

Save as Timer.bat

Or you can download the source code and rename to Batch Timer Source Code.bat

Execute

Untitled.png

Double-click the file to execute

Select the theme,you have 3 themes to choose from: Light/Dark/Martix(green text on black background)

Select the time and you done!

The time counts down. If the time is up(seted at 0) then shows a message

Done!

Done!! I created a timer in Windows Batch!!!