Hi All
when run Menu.bat file, it asks about select the option? options are as follows
1 Generate report staff
2 Generate report subjects
3 Generate report class
4 exit
My requirment is that when user enter incorrect option(i.e. not between 1 and 4) , I want to display message something like "you entered incorrect opntion, try again".
Thank You
IF not condition
Moderator: DosItHelp
Re: IF not condition
Got the answer. answer is,
@echo off
:menu
1 Generate report staff
2 Generate report subjects
3 Generate report class
4 exit
echo.
set /p sample=Type option:
if "%sample%"=="1" call r1.bat
if "%sample%"=="2" call r2.bat
if "%sample%"=="3" call r3.bat
if "%sample%"=="4" goto Quit
if "%web%" gtr "4" goto Message
if "%web%" lss "1" goto Message
goto menu
:Message
echo you entered incorrect option
pause
goto menu
:Quit
exit
@echo off
:menu
1 Generate report staff
2 Generate report subjects
3 Generate report class
4 exit
echo.
set /p sample=Type option:
if "%sample%"=="1" call r1.bat
if "%sample%"=="2" call r2.bat
if "%sample%"=="3" call r3.bat
if "%sample%"=="4" goto Quit
if "%web%" gtr "4" goto Message
if "%web%" lss "1" goto Message
goto menu
:Message
echo you entered incorrect option
pause
goto menu
:Quit
exit