2016-02-28 93 views
0

問題是變量未被if語句改變,我不知道爲什麼。我一直在搞這個,我找不到一個辦法讓它工作。批量更改if語句中的變量

:Sim 
cls 

set /a b=(3 * %random%)/32768 + 1 

set /a a=(3 * %random%)/32768 + 1 

::Sets a random number between 1 and 3 

if %a% == 1 set %a%=1 

if %a% == 2 set %a%=2 

if %a% == 3 set %a%=1 

if %b% == 1 set %b%=2 

if %b% == 2 set %b%=1 

if %b% == 3 set %b%=2 

::Is supposed to change the variable, but does not :(


echo %a% 

echo %a% 
:: only echos the random numbers 

pause > nul 
goto Sim 

回答

0

理解了它只是需要刪除%S