Batch: %time% won't update in loop

I got a problem with a batch-file.
Here it comes:

 

echo %time%
pause
for /L %%N IN (0, 1, 3) DO (
echo %time%
pause
)
echo 3. %time%

 

The first time in the loop is correct, but in the folowing all the times printed in the loop are the same, regardless how long you wait pressing the key. The last time is correct again. Somehow the %time% variable is not updated within the loop.

 

Try what I have put below. What exactly do you want it to output?

@echo off
SetLocal EnableDelayedExpansion
echo !time!
pause
for /L %%N IN (0, 1, 3) DO (
echo !time!
pause
)
echo 3. !time!
EndLocal
 

你可能感兴趣的:(update)