Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a Windows command-line diff tool that is free?

I need to compare two binary files and see if they are different or not. I'm not interested in how they are different I just need to know if they are.

share|improve this question

4 Answers 4

up vote 8 down vote accepted

Use the comp command under cmd.exe

[C:\]comp /?
Compares the contents of two files or sets of files.                                                                    

COMP [data1] [data2] [/D] [/A] [/L] [/N=number] [/C] [/OFF[LINE]]                                                       

  data1      Specifies location and name(s) of first file(s) to compare.                                                
  data2      Specifies location and name(s) of second files to compare.                                                 
  /D         Displays differences in decimal format.                                                                    
  /A         Displays differences in ASCII characters.                                                                  
  /L         Displays line numbers for differences.                                                                     
  /N=number  Compares only the first specified number of lines in each file.                                            
  /C         Disregards case of ASCII letters when comparing files.                                                     
  /OFF[LINE] Do not skip files with offline attribute set.                                                              

To compare sets of files, use wildcards in data1 and data2 parameters.
share|improve this answer
2  
The added benefit of using comp is that you know it'll work on any Windows machine without having to install anything. –  dwj Sep 22 '09 at 13:44
3  
And there's also the fc command for a more flexible file comparison, in case there is a need for diff-like behavior. –  A Dwarf Sep 22 '09 at 13:53
2  
I think you should edit your answer to mention fc. That seems useful, too. –  Ehtesh Choudhury Sep 12 '12 at 16:09

To simply see if they are different, you could MD5 them. For more detailed information on differences there is GNU DiffUtils for Windows.

share|improve this answer

The title is misleading, since the author doesn't really want a full diff. He only wants to know IF 2 files are different. The distinction is important if the files are big.

Checksumming methods will obviously read both files entirely. As far as I could tell, Windows' FC and COMP both also read the entire files, even if there was a difference in the first bytes.

As John T suggests, get GNU diffutils, which includes cmp.exe. With big files, cmp will be a lot faster than COMP or FC.

That is if you need it to be a command-line tool. If you can use a GUI shareware, Total Commander has a "Compare Files" command, and a "Synchronize dirs" command which can be set to compare files by content. Both are extremely fast.

share|improve this answer

Mr. A Dwarf has given the exact answer above. Using command prompt you can even compare two folders. To understand all with example you can check the tutorial

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.