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?
14 Answers
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.
There is a command in Windows which can give you a binary comparision of two files
fc /b <filename1> <filename2>For more information -
This works equally well on Windows 7
If you're looking for tools , there is an answer already -
1Internal compare tool of Total Commander 64bit works fine on files over 2GB. (File -> Compare by content)
fc.exe works great in PowerShell but just for completeness, I'm adding the PowerShell docs version of compare below:
Compare-Object -ReferenceObject $(Get-Content textout.txt) -DifferenceObject $(Get-Content textout1.txt) 2