How can I binary compare two large files in Windows?

9,558

Solution 1

As @dhiwakar-ravikumar already answered, you can use the "file compare" (fc) Windows command to compare 2 files (or sets of files), and use the /b parameter to do a binary comparison.

However, it should be noted that contrary to the "cmd" command shell, in PowerShell, the command has to be spelled out as fc.exe to avoid the "fc" alias to Format-Custom to take precedence. Like so:

fc.exe /b [<Drive1:>][<Path1>]<FileName1> [<Drive2:>][<Path2>]<FileName2>

Also note that if the extension of the files to compare is one of .exe, .com, .sys, .obj, .lib or .bin, a binary comparison is performed by default and the /b parameter can be omitted to the same result.

Solution 2

There is a command in Windows which can give you a binary comparision of two files

fc /b <filename1> <filename2>

For more information - https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/fc.mspx?mfr=true

This works equally well on Windows 7

If you're looking for tools , there is an answer already - https://stackoverflow.com/questions/8166697/tool-for-comparing-2-binary-files-in-windows

Share:
9,558

Related videos on Youtube

chrips
Author by

chrips

Updated on September 18, 2022

Comments

  • chrips
    chrips 3 months

    I have two 4GB temporary files.

    I did a quick visual inspection using a hex editor and see they appear to be the same. Is there a command I can use in something like PowerShell to binary compare the two so I can be certain they are the same?

  • mini
    mini almost 4 years
    What about Win10? The 1st link also does not exit any more!
  • desseim
    desseim almost 3 years
    I initially tried to edit @dhiwakar-ravikumar 's answer to include the .exe extension to the command for PowerShell (which OP specifically asked about) and update the documentation link, but it was rejected as deviating too much from the original answer intent, so I tried to post it as a new answer as I think it is relevant information (someone even asked in a comment). When downvoting, I'd sincerely appreciate info on why and / or advice on a better couse of action.
  • chrips
    chrips almost 3 years
    Hi desseim, thanks for your answer. I came back to this and found out that YEAH powershell won't take fc and your answer has a heck of a lot more information. Thanks
  • desseim
    desseim almost 3 years
    How would you use it to compare binary files ? As is it treats them as text (and outputs the whole binary "garbage"). I tried the AsByteStream parameter mentioned in the documentation but it was very memory hungry and inefficient (I didn't get it to terminate comparing ~1MiB files on my setup, even after several minutes).
  • chrips
    chrips almost 3 years
    @desseim Uh oh, I guess I'll have to look into it and update!