How to? Comparing strings with blanks

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Oct 18, 2008
265
1
#1
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
 
#4
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
 
Oct 18, 2008
265
1
#5
Thanks for trying this out -- @unicode generated the name set of numbers for each character -- the "==" or "EQ" is a case neutral compare?