[windows2000] Re: Case sensitivity at cmd.exe

  • From: "Dan Manell" <dan.manell@xxxxxxxxx>
  • To: <windows2000@xxxxxxxxxxxxx>
  • Date: Thu, 15 May 2003 10:01:06 +0200


> Hi list,
> 
> Does anyone know how I can get string comparisons to be
> non-case-sensitive?  For example:
> 
> If {a} EQU {A} net send ray test
> (or
> If {a}=3D=3D{A} net send ray test
> )
> 
> a and A are not equal.  I do not see a switch I can use when I launch
> cmd.exe to change this or anything.  Is this just the way it 
> is, or can
> I do something about it?

Checking help on IF tells me this:

"If Command Extensions are enabled IF changes as follows:

    IF [/I] string1 compare-op string2 command
    IF CMDEXTVERSION number command
    IF DEFINED variable command

where compare-op may be one of:

    EQU - equal
    NEQ - not equal
    LSS - less than
    LEQ - less than or equal
    GTR - greater than
    GEQ - greater than or equal

and the /I switch, if specified, says to do case insensitive string
compares.  The /I switch can also be used on the string1==string2 form
of IF.  These comparisons are generic, in that if both string1 and
string2 are both comprised of all numeric digits, then the strings are
converted to numbers and a numeric comparison is performed."

So adding /I to the IF statement does what you want.

/Dan



==================================
To Unsubscribe, set digest or vacation
mode or view archives use the below link.

http://thethin.net/win2000list.cfm

Other related posts: