How does one prints the current time in a batch file script?
I've seen the webpages:
But neither are good:
With the 1st, using the variable %TIME%
, it prints the same time - the time isn't changing.
With the 2nd, using the command TIME
, it doesn't print the seconds.
The code in the batch file is:
@echo OFF
for /l %%x in (1, 1, 100) do (
echo "*** Repeat no. %%x ***"
echo "%TIME%"
REM Executing some commands here which take about 5 seconds
for /l %%i in (1, 1, 20) do (
echo "-- %%i:"
echo "%TIME%"
REM Executing a command here which take about 1 second
)
)
I can't believe that a google search didn't solve this for me!