Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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 :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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%)

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading