I am trying to make a random number generator. However, I get an error message. The batch file code is
Code: Select all
:PreparationQuestionsAndValidityCheck
set /p MIN="What do you want the minimum number to be? Any integer between 0 and 32767 is allowed. "
if %min% gtr 32767 (goto InvalidMinimumIsTooBig)
if %min% lss 0 (goto InvalidMinIsTooSmall)
if %min% % 1 neq 0 (goto InvalidMinimumIsNotAnInteger)
set /p MAX="What do you want the maximum number to be? Any integer between 0 and 32767 is allowed. "
if %max% gtr 32727 (goto InvalidMaximumIsTooBig)
if %max% lss 0 (goto InvalidMaximumIsTooSmall)
if %max% lss %min% (goto InvalidMaximumIsLessThanMinimum)
if %max% % 1 neq 0 (goto InvalidMaximumIsNotAnInteger)
set /p NTG="How many would you like to generate? "
if %ntg% % 1 neq 0 (goto InvalidNTGIsNotAnInteger)
set /a glc=0
echo Generated number(s):
:GenerationLoop
set /a glc=glc+1
if %glc%==%ntg% goto SuccessfulGeneration
set /a result=(%RANDOM%*%max%/32768)+%min%
echo %result%
goto GenerationLoop
:SuccessfulGeneration
echo Continue when you are ready to exit.
pause
echo Exiting in 3
timeout 1 /nobreak
echo Exiting in 2
timeout 1 /nobreak
echo Exiting in 1
timeout 1 /nobreak
exit
:InvalidMinimumIsTooBig
echo Your settings are invalid. The minimum value is greater than 32767.
echo The generator will exit in 15 seconds. You can skip the delay by pressing a key.
timeout 15
exit
:InvalidMinimumIsTooSmall
echo Your settings are invalid. The minimum value is less than 0.
echo The generator will exit in 15 seconds. You can skip the delay by pressing a key.
timeout 15
exit
:InvalidMinimumIsNotAnInteger
echo Your settings are invalid. The minimum value is not an integer.
echo The generator will exit in 15 seconds. You can skip the delay by pressing a key.
timeout 15
exit
:InvalidMaximumIsTooBig
echo Your settings are invalid. The maximum value is greater than 32767.
echo The generator will exit in 15 seconds. You can skip the delay by pressing a key.
timeout 15
exit
:InvalidMaximumIsTooSmall
echo Your settings are invalid. The maximum value is less than 0.
echo The generator will exit in 15 seconds. You can skip the delay by pressing a key.
timeout 15
exit
:InvalidMaximumIsLessThanMinimum
echo Your settings are invalid. The maximum value is less than the minimum value.
echo The generator will exit in 15 seconds. You can skip the delay by pressing a key.
timeout 15
exit
:InvalidMaximumIsNotAnInteger
echo Your settings are invalid. The maximum value is not an integer.
echo The generator will exit in 15 seconds. You can skip the delay by pressing a key.
timeout 15
exit
:InvalidNTGIsNotAnInteger
echo Your settings are invalid. The number of results to generate is not an integer.
echo The generator will exit in 15 seconds. You can skip the delay by pressing a key.
timeout 15
exit
Code: Select all
C:\Users\<my user name>\Desktop>■:
The system cannot find the drive specified.
Thanks,
uwu owo TwT