So, I play a little with Batch, and I ran into a problem that you guys could help with. So I’m trying to do something that you can answer “Yes” or “No” to the question, and if you do not answer “Yes” or “No”, then he will tell you that this is an invalid answer. You can take a look at the code right here.
:Choice
set /p Choice=Is a stone a stone?
if %Choice%==Yes goto Correct
if %Choice%==No goto Incorrect
else goto Invalid
:Correct
echo You are correct!
pause
goto end
:Incorrect
echo You are incorrect!
pause
goto end
:Invalid
echo You did not enter a valid answer.
pause
goto end
:end
exit
Therefore, I cannot use Else the way I did in code, but do you know how I will do the same as Else if it worked? It may seem a bit confusing, hope you can understand. Just to clarify, here is a bit that I don't know how to do:
else goto Invalid
source
share