Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

How to? Comparing strings with blanks

Oct
356
2
Hello –

A pointer or 2 on this would be appreciate –

I have a few network drives that I map to my system, so I wrote a btm file to make sure the
correct drive is mapped to the correct drive letter

The label on one drive is and I have its label in the following line in the btm file

set s2=Base (at NAS-02)

in the script I use @label function to get the label of the drive, in this case m:, that this drive
should map at

the results of the @label function seems to be returning the string noted in var s2, but when
I issued the command (var ll had the results of @label)

if “%s2" == “%ll”

the results is false – I could not figure out if there were characters in there that I could not see like a tab

I then use the @md5 function to turn each string in to a hex string value and these values compared to be true –

Any pointers on how to figure out why the s2 and ll did not compare to be the same?

Thanks
 
I think I'd try plugging each into @UNICODE and examining the returns.
 
I can't reproduce a problem. o: is an external hard drive.
Code:
v:\> echo %@label[o:]
WD (wd)

v:\> set ll=%@label[o:]

v:\> set s2=WD (wd)

v:\> if %s2 == %ll echo yes
yes

v:\> if "%s2" == "%ll" echo yes
yes
 
Thanks for trying this out -- @unicode generated the name set of numbers for each character -- the "==" or "EQ" is a case neutral compare?
 
YES. The only case sensitive string comparison operator is EQC (the C refers to CASE). All other string comparison operators are case insensitive. Legacy of COMMAND.COM
 

Similar threads

Back
Top