How can I binary compare two large files in Windows?

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?


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