1.

Solve : Upper and Lower case both should be accepted?

Answer»

Hi,

my bat file does not accept the values given by the user in upper CASE.
Please guide on below what changes should be done so that
bat should should accept both lower and upper case values.


@ECHO off
:start
Set /P Ename=ENTER Environment Name and then Press Enter^>

IF %Ename%==wld GOTO WLD
IF %Ename%==cmd GOTO CMD
IF %Ename%==cfgcent GOTO CFGCENT
IF %Ename%==ricdb GOTO RICDB
echo Hello You Have entered wrong Environment
pause
goto start
Before the expression in an If STATEMENT you can add the /I switch to tell IF to ignore Case.

Example:
Code: [Select]If /I '%value%'=='Test' echo Test
Hope this Helps
,Nick(macdad-)Don't work for me!Quote from: Geek-9pm on April 14, 2009, 02:33:43 PM

Don't work for me!

Code: [Select]C:\Users\_CORE>if /I 'cat' equ 'cat' echo OK
OK

C:\Users\_CORE>if /I 'CAT' equ 'cat' echo OK
OK

C:\Users\_CORE>if /I 'CaT' equ 'cAt' echo OK
OK

C:\Users\_CORE>if 'CaT' equ 'cAt' echo OK



How it can't work ?Quote from: devcom on April 14, 2009, 02:51:54 PM
How it can't work ?

YEAH, right!

Code: [Select]C:\>if /i "GeeK"=="gEEk" echo OK
OK
What do you mean, Geek-9PM? You should know better than to give that OLD "doesn't work" stuff here.

Quote
Code:
C:\>if /i "GeeK"=="gEEk" echo OK
DUH, do not work for me.
leave out C:\> OH!

Learn something everyday Quote from: Geek-9pm on April 15, 2009, 05:34:54 PM
DUH

You said it...



Discussion

No Comment Found