views:

26

answers:

1

I would like to check diffs and when files are not same,stop compare files.
Compare any files C:/UML/reports/* and C:/UML/Test/*.
In this two directory has same file names and also aim is to want to compare same file by name.
I try to that by below code in .bat file.

diff.bat

@echo off
for %%i in (C:\UML\reports\*) do comp %%i C:\UML\Test\%%~nx%i
if %errorlevel% == 0 (echo OK) else (echo NG & PAUSE)

I know that if~ section place was not collect.
But I do not have any solution now for that.

Thanks in advance.

+1  A: 

You can skip the for loop entirely and simply hand comp wildcards:

comp C:\UML\reports\* C:\UML\Test\*

To avoid the question at the end, you can pipe "N" into comp:

echo N|comp C:\UML\reports\* C:\UML\Test\*
Joey
Thanks Johannes Rössel. But that code always asked 'Compare more files (Y/N)? ' and need to answer for continue comp file. I lacked my request. I would like to run progress automatic when OK,otherwise NG and pause.Anyway appreciate quick answer.
tknv
Ah, sorry. I hope this one suits a little better.
Joey
Thank you very much,at that time I found that to use pipe solution too.
tknv