I’m new here, and I’ve been working on a Batch Script that generates a number between a maximum and minimum number. Here is the script (or most of it):
echo Choose the Minimum Number (Must be over -1):
set /p min =
pause>nul
echo Choose the Maximum Number (Must be under 32768):
set /p max =
pause>nul
set /a range= %max% – %min%
set minrand = 0
set maxrand = 32767
set /a number = (%random%-%minrand%) * %range% \ %maxrand% + %min%
echo %number%
When I run it I get this error message:
Missing Operand.
ECHO is off.
What’s wrong?
set /a number = (%random%-%minrand%) * %range% \ %maxrand% + %min%
You forgot to change these two variables.
How To Ask Questions The Smart Way