Trying to make a quiz show.bat file and having trouble with the If-Set coding:
:10
echo @: (Press any key to continue)
pause >nul
cls
echo Bonus Question 1:
echo Translate the letters in CAPS.
echo @: Copy the sentence and translate the words in CAPITALS.
echo Il nome di mia ZIA e Gabriella e il nome di mio ZIO e Nick.
echo @: Careful, you only get 3 goes!
echo @: now you try!
set /p BonusAnswer1=">"
set /p BonusAnswer1=">"
if "%BonusAnswer1%"=="Il nome di mia aunty Gabriella e il nome di mio uncle Nick. echo well done! &goto:11
if "%BonusAnswer1%"=="Hint" echo @: Copy the sentence and translate ZIA and ZIO. Only put a capital for Il, Gabriella and Nick. &goto:10
here is where I have the problem:
if "%Bonus1Tries%"=="3" set Bonus1Tries=2 &echo you only have %Bonus1Tries% left!
the only part of that coding that isn't working is it says:
you only have 3 tries left!
instead of
you only have 2 tries left!
which means that
set Bonus1Tries=2
isn't working. Can you help please and thank you in advance! -Batch Man
inside a code block you need delayed expansion
, or you split the command (if possible):
if "%Bonus1Tries%"=="3" set "Bonus1Tries=2"
if "%Bonus1Tries%"=="2" echo you only have %Bonus1Tries% left!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With