I have the following batch script but it doesn't go to label:
for /f %%i in ('some commands') do echo %%i
IF %%i == A (goto :A) else (goto :end)
IF %%i == B (goto :B) else (goto :end)
:A
echo "OK A"
:B
echo "OK B"
:end
echo "It is not A or B"
exit
If the output of the command is the letter A, then go to the label A, if it is B then to the B and if it is "empty" or "something else" to go to end. But I can't make it go to labels :A or :B
I tried it with quotes or square brackets and I don't get the desired result:
IF [%%i] == [] goto :end
IF [%%i] == [A] goto :A
IF [%%i] == [B] goto :B
or
IF "%%i" == "" goto :end
IF "%%i" == "A" goto :A
IF "%%i" == "B" goto :B
thanks in advace