@Raymond B
Mate, you're a ******* idiot. @Justin F answered almost perfectly, and you said his answer was incorrect. Your answer utilises the FOR loop, which is highly unneccessary for what the OC is asking. Choose which one is better between either 1 or 100 lines and thats how fucked ur brain is.
Justin's code:
@echo off
echo %TIME%
echo Hour=%TIME:~0,2%
echo Min=%TIME:~3,2%
echo Sec=%TIME:~6,2%
Works perfectly, however the OC wanted each to be a seperate variable, therefore the answer should be:
@echo off
set Hour=%TIME:~0,2%
set Min=%TIME:~3,2%
set Sec=%TIME:~6,2%
echo Time: %Hour%:%Min%:%Sec%
If you want to actually make a working clock, I would use the choice command. Other options inclue using timeout or ping, but both break quickly.
@echo off
:start
echo The time is: %TIME:~0,2%:%TIME:~3,2%:%TIME:~6,2%
choice /t 1 /n /m "Exit? [Y/N] /d 2
if ERRORLEVEL=2 goto start
if ERRORLEVEL=1 exit
There you go, ******* spastic cunts.