txt file compare from bat file

I need to compare what files are copied after programs are installed. After trying some programs out there I decided to do it myself so I built a batch file to read the files on my hdd.

[code]

dir /b /s /a /p /o:gen > file_list.txt

file_list.txt

[/code]

works great but now I need to compare the two files.

heres my latest attempt.

[code]

@echo off & cls & setlocal enabledelayedexpansion

REM // CREATE VARIABLES FOR FILE 1
set c1=0
for /f %%a in (Test1.txt) do (
set /a c1 +=1
set a!c1!=%%a
)
set finala=!c1!

REM // CREATE VARIABLES FOR FILE 2
set c2=0
for /f %%b in (Test2.txt) do (
set /a c2 +=1
set b!c2!=%%b
)

REM // TO CHECK WE COMPARE THE VARIABLES
set counter=1
:LOOP
if !a%counter%! == !b%counter%! (
REM echo Line %counter% = No change
if %counter% GEQ %finala% (goto :END)
set /a counter +=1
goto :LOOP
) else (
echo error... !a%counter%! and !b%counter%! on line %counter% don't match
if %counter% GEQ %finala% (goto :END)
set /a counter +=1
goto :LOOP
)

:END
echo Test complete.
pause>nul


[/code]


it sees the files and opens a cmd box but thats it. it just stays there. If I change one of the filenames it outputs a error so it is seeing the files. what I need to get it to do is output the differance to a text file as an error. can someone tell me what I am doing wrong.

Comments

  • Ok I found an easier way to do this. In winxphome. I can do this.
    [code]

    fc /C /L /OFF c: est est1.txt c: est est2.txt > c: esterror.txt

    [/code]

    what I need now is a way to pick the folder and file it compares. maybe put a little gui around it. Anybody have any Ideals.
  • ok I found an easier way. I can do this
    [code]

    fc /C /L /OFF c: est est1.txt c: est est2.txt > c: esterror.txt

    [/code]

    this still has problems though. I need to pick the files it compares. right now I have to change the file names. I thought some one might have some Ideals. Maybe even know the right way to put a little gui around it.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion