The code below should change the background color after the user types a number from 0 to 7, but the program closes shortly after the user types the number and does not change the color. I'm using the win7 cmd.
@ECHO OFF
SET /p num=Digite um numero de zero a sete:
IF %num% == 0 (
color 0f
) ELSE (
IF %num% == 1 (
color 1f
) ELSE (
IF %num% == 2 (
color 2f
) ELSE (
IF %num% == 3 (
color 3f
) ELSE (
IF %num% == 4 (
color 4f
) ELSE (
IF %num% == 5 (
color 5f
) ELSE (
IF %num% == 6 (
color 6f
) ELSE (
IF %num% == 7 (
color 7f
) ELSE (
ECHO error.
)
)
pause