dimanche 27 décembre 2015

Cannot use !random! in batch file

@echo off
setlocal enableDelayedExpansion

set /p startIndex="Start index: "
set /p endIndex="End index: "

for /l %%a in (%startIndex% 1 %endIndex%) do (
    set /a seed = !random!
    echo %seed%
)
set /p endfile="Wait for it...."

I expect that this script will print out some random numbers. But it does not work. It just printed out some lines with same content: "Echo is off ."

How can I fix this code ?




Aucun commentaire:

Enregistrer un commentaire