Missing statement when using variables set to / p

I use this piece of code in my script, and every time the script receives this part (sets), the CMD throws an error of the missing statement (operandus, etc.). I could not find the answer to this question, even when I spent an entire hour just searching and searching. If anyone could give me a hint, I would be damn happy!

    :start
echo Good Job everyone!
set /P /a fglobal = You won: 
set /P /a r = Rery: 
set /a global = %fglobal%+%r%
set /P /a size = MaxSize: 
set /a maxsize = %size%*100
set /a mxp = %global%/100
set /a rxp = %random%/1000
set /a xp = %mxp%+%rxp%
echo.
echo SUCCESS!
echo.
echo.
echo Gained money: %global% $ / %maxsize% $
echo Gained XP: %xp%
echo.
pause
cls
+4
source share
2 answers

The solution is to avoid gaps.
And don't mix options: /Por /A, but not both together.

set /P fglobal= You won: 
set /P r= Rery: 
set /a global= %fglobal%+%r%
set /P size= MaxSize: 
set /a maxsize= %size%*100
set /a mxp= %global%/100
set /a rxp= %random%/1000
set /a xp= %mxp%+%rxp%
+3
source

Do not put spaces or use percentages.

set /p a=you won:
set /p r=Reatry:
set /a b=a+r
echo.%b%
+4
source

All Articles