Variable Delay and Command Expansion
[ Last edited by plp626 on 2008-4-16 at 11:30 AM ]
@echo off
::Display source code
more %0&pause
for /l %%a in (1 1 4) do set t=%time% & echo %random% /%t%/
echo -----------&pause>nul
setlocal enabledelayedexpansion
for /l %%a in (1 1 4) do set t=%time% & echo !random! /!t!/
endlocal
echo -----------&pause>nul
for /l %%a in (1 1 4) do set t2=%time% & call echo %%random%% /%t2%/ \%%t2%%\
echo -----------&pause>nulPress any key to continue. . .
23520 //
23520 //
23520 //
23520 //
-----------
25655 / 3:22:09.42 /
23230 / 3:22:09.42 /
29496 / 3:22:09.42 /
30091 / 3:22:09.42 /
-----------
2940 // \ 3:22:16.28 \
12893 // \ 3:22:16.28 \
1357 // \ 3:22:16.28 \
28853 // \ 3:22:16.28 \
-----------
set n=1
set/a n+=1&call echo %%n%%&pause2
Press any key to continue......
[ Last edited by plp626 on 2008-4-16 at 11:30 AM ]
