1.

Solve : How to invalid invalid string input?

Answer»

Hi,

I have BATCH file and i want it to identify the invalid user input, it should validate the user input given and should
return the message saying that "You have entered invalid Environment"
Please HELP how it is possible with below CODE..

REM Please Enter Environment DETAILS Options are
REM ricdb
REM cfgcent
REM cmd
REM wld

Set /P Ename=Enter Environment Name^>

IF '%Ename%'=='wld' GOTO WLD
IF '%Ename%'=='cmd' GOTO CMD
IF '%Ename%'=='cfgcent' GOTO CFGCENT
IF '%Ename%'=='ricdb' GOTO RICDB

Thanks & Regards

Uday BholeCode: [Select]REM Please Enter Environment Details Options are
REM ricdb
REM cfgcent
REM cmd
REM wld

:start
Set /P Ename=Enter Environment Name^>

IF '%Ename%'=='wld' GOTO WLD
IF '%Ename%'=='cmd' GOTO CMD
IF '%Ename%'=='cfgcent' GOTO CFGCENT
IF '%Ename%'=='ricdb' GOTO RICDB
echo sorry invalid variable
pause
goto start

Something like that?

FB



Discussion

No Comment Found