'What can I do to fix this batch error when I'm adding to variables together?
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`
Solution 1:[1]
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%)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | user2956477 |
