|
Answer» Thank you all guys, i now have a program, which works EVEN better han I INTENDED it to. Here is the program I'm using and it works fine with all options, i've tested it.
CLS @ECHO OFF ECHO. :LOOP SET /P CHOICE=DO YOU LOVE Y0UR HUSBAND(Y/N)?: ECHO.
IF /i '%CHOICE%'=='Y' GOTO YES IF /i '%CHOICE%'=='N' GOTO NO
ECHO you did not answer the question properly. ECHO. GOTO LOOP
:YES start Y
GOTO STOP
:NO start N
:STOP EXIT
The program prompts the user to GIVE another answer in case he typed a wrong answer and shows him his wrong answer. Both uppper and lower case answers are taken into account with the /i. The 2 other programs works if we USE start Y or start N, not with ECHO Y or ECHO N, but we don't need to use the extension .bat, though it is better to use it in case we have another file with the same name and a different extension in the same folder like Y.exe. The start statement opens a second command prompt window, so we need to close the fist one with the exit statement after the STOP: at the end of the program.By using the parameter /b with the start statement, we avoid opening a second command prompt window ex: start /b Y.bat, but we must keep the exit statement at the end of the program, because it brings unwanted messages.
|