Solved

How to compare two or more files in windows batch file and display differences?

Posted on 2010-11-10
7
453 Views
Last Modified: 2012-05-10
Hi,

I am trying to write a windows batch file that will compare two files and display the difference.  Say a two files in drive C:\.


Regards
Sandy
0
Comment
Question by:sweetiepie70
7 Comments
 
LVL 82

Accepted Solution

by:
oBdA earned 125 total points
Comment Utility
That program already comes with any Windows version:
fc.exe <file1> <file2>
0
 
LVL 90

Expert Comment

by:John Hurst
Comment Utility
Look up Winmerge. This is a free (www.winmerge.org) utililty that is very good for file comparisons. It supports command line mode which can then be used in a batch file. See here:

http://winmerge.org/docs/manual/CommandLine.html

... Thinkpads_User
0
 

Author Comment

by:sweetiepie70
Comment Utility
I would like to write a batch script from scratch as a .txt file and then saved as a .bat file to run in windows command prompt.  A batch file scripting should give me that result.
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 51

Expert Comment

by:Bill Prew
Comment Utility
As mentioned earlier, you can use either FC or COMP which come built in.

~bp
0
 
LVL 19

Assisted Solution

by:Thommy
Thommy earned 125 total points
Comment Utility
Using fc for file compares in a batch script...


@echo off

setlocal



set Files_1=c:\dir1\*.txt

set Files_2=c:\dir2\*.txt



(fc %FILES_1% %FILES_2% /l) || goto DIFFERENT



echo Files sind gleich

goto END



:DIFFERENT

echo Files sind ungleich



:END



endlocal

Open in new window

0
 
LVL 68

Expert Comment

by:Qlemo
Comment Utility
This question has been classified as abandoned and is being closed as part of the Cleanup Program.  See my comment at the end of the question for more details.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now