Home > Software engineering >  What can I do to fix this batch error when I'm adding to variables together?
What can I do to fix this batch error when I'm adding to variables together?

Time:05-17

Every time I run the code below I get this error: '10 1' is not recognized as an internal or operable program or batch file. I have checked stack overflow and couldn't find anything. I apologize if this is a bad question. This is the code:

`@echo off 
set chips=10
set return=1
echo %chips% chips remaining
echo choose a number between one and ten:
set /p num=number:
set /p yn=play? 
if %yn%==y (echo starting..) else (exit) 
timeout /t 3
SET /A test=%RANDOM% * 10 / 32768   1
echo %test%
if %test%==%num% (%chips% %return%)
echo %chips% chips remaining`

CodePudding user response:

if comparsion should be followed by recognized command, e.g. set /a var=%chips% %return%, but is not in your example

if %test%==%num% (%chips% %return%)

  • Related