I'm writing a batch file right now and encountered a problem. I need to make "OR" statement in "AND" statement in batch script. Here's my code:
@echo off
set /p a="a="
set /p b="b="
if "%a%" == "5" (
if "%b%" == "8" (
set /a "c=%a%*%b%"
goto :win
)
if "%b%" == "2"(
set /a "c=%a%+%b%"
goto :win
)
)
goto :fail
:win
echo %c%
goto :exit
:fail
echo U'r not a magician!
:exit
pause
The problem is that it only works fine without second nested "IF" expression but I need a possibility of getting both results. Any suggestions here?
Aucun commentaire:
Enregistrer un commentaire