Page 1 of 1

Clock

Posted: 20 Oct 2013 04:17
by Batch Artist
Hello guys, just a little point out here since I constantly get asked how to make a clock or a mechanism that shows you the time and/or date. The following codes are examples:

Code: Select all

@ECHO off
ECHO The time is %time%
ECHO The date is %date%


Code: Select all

@ECHO off
ECHO %time%     %date%


As you can see, Time and date variables are already existent, so there is no need to create variables or make huge lines of code to display time and date. Using the preset variables uses less time, and is very VERY simple to use!

Hope this helps!

.Batch Artist.

Re: Clock

Posted: 25 Oct 2013 05:32
by Adrianvdh
How about one the ticks?

Code: Select all

@echo off
:loop
cls
echo %time%
goto loop

Re: Clock

Posted: 25 Oct 2013 05:36
by Batch Artist
Adrianvdh wrote:How about one the ticks?

Code: Select all

@echo off
:loop
cls
echo %time%
goto loop


Very true, and you can also add colouring into it aswell. E.G...

Code: Select all

@echo off
:Loop
CLS
ECHO %time%
color A
color B
color C
color D
color E
color F
color 9
GOTO Loop

Re: Clock

Posted: 25 Oct 2013 06:07
by Adrianvdh
I know dude, she! Everyone know that :)