Batch: nested for variable cannot be compared -


i need compare 2 text files , lines appear in both of them. code:

@echo off /f "tokens=*" %%a in (%1.txt) (     /f "tokens=*" %%b in (%2.txt) (         echo %%a %%b         if %%a==%%b echo ok                      ) ) 

i test files a.txt (lines a, c , d) , b.txt (lines a, b , c). output:

a  b  c  c  c b  c c  d  d b  d c 

if substitute %%a==%%b %%a==a, output following:

a  ok                   b  ok                   c  ok                   c  c b  c c  d  d b  d c  

while test %%b==a instead, output same @ %%a==%%b.

it seems me %%b couldn't compared anything. doing wrong?

your code correct, second file (b.txt) has trailing spaces.


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -