vendredi 21 septembre 2018

Issues using a variable to get a image in batch

I was trying to make a batch file that would create a random number between 1 and 13 and get the file called "[random number].jpg", but it isn't working.

The code:

`SET /A rand=%RANDOM% * 13 / 32768 + 1
IF NOT EXIST "IMGS\%rand%.jpg" (
    ECHO ERR: File " %rand%.jpg " not found
    pause
    EXIT
)`

The output: ERR: File " 6.jpg " not found

Any thoughts on why it's doing this?




Aucun commentaire:

Enregistrer un commentaire