I am trying to execute if-else loop in batch programming, but it is giving me unexpected output
code:
echo 1. ICM
echo 2. Mini ICM
echo 3. SST
set /p ch = Enter the number(1 or 2 or 3) for Type of Environment :
echo.
IF "%ch%" EQU "1" (
set str1="ATTST"
) ELSE (
IF "%ch%" EQU "2" (
set str1="NBIST"
) ELSE (
IF "%ch%" EQU "3" (
set str1="NBISST"
) ELSE (
echo "Incorrect choice"
)))
echo "######################"
echo "Value of str1 is :"
echo "%str1%"
pause
Output I am getting is :
1. ICM
2. Mini ICM
3. SST
Enter the number(1 or 2 or 3) for
"Incorrect choice"
"######################"
"Value of str1 is :"
""
Press any key to continue . . .
Can anyone help me, where I am wrong?