Ok, so this issue I'm having involves CMD scripting and this:
DIR /A-D /B /S > DIR.DAT
FOR /F "TOKENS=*" %%I IN (DIR.DAT) DO (
CALL :DICEROLL
IF %NUMBER%==0 (
ECHO BOOM BADDA BOOM
) ELSE (
ECHO %NUMBER%
)
)
:DICEROLL
SET /A NUMBER=%RANDOM% %% 16
When I run the file I get stuff like this:
15
15
15
15
Instead of what I'm wanting which would be something like this:
14
0
8
10
I'm just very confused on why its not generating random numbers for each line of text it goes through. Instead it appears to only echo the first generated number. Any help would be greatly appreciated and sorry if this is confusing I'm not very good at putting my problems into words and its my first time on one of these sites in general.
Aucun commentaire:
Enregistrer un commentaire