Comparing File Contents Right from the Context Menu

⚠️ Note: the images in this post were lost during an outage in 2016. The Broken Image Placeholder plugin automatically replaces the missing images with a funny placeholder.

We have 2 source files:

a.txt
a1t c1r b1a class M d1i b.txt

using System; a1t c1t b1a public partial class M d1i

As a reference I will use the file content comparison in Total Commander 8.52a, which I have always been completely happy with, although I think it has been the same for quite a while now:
File content comparison in Total Commander
Now on to applications with the same feature. On https://diff-ext.sourceforge.net/ I found an application that adds an option to the file context menu for comparing the contents of 2 or 3 files. That is also where I learned about the following programs, which we will take a closer look at here:

  1. KDiff3
  2. tkdiff
  3. WinMerge
  4. 👻 This link died before ICQ did.
  5. Beyond Compare
KDiff3 10.9

File content comparison in KDiff3
It works a little differently from Total Commander, but it is not bad. Unlike TC, when only one or a few characters change it cannot highlight just that change – it spits out the whole line as changed.

tkdiff 2.82

File content comparison in tkdiff
It recognizes that the beginning of the file is different and also that a letter is different, but that is exactly what breaks its neck, because it does not handle it intelligently – it is something completely different, yet it keeps trying to find a match between lines with 20 characters and lines with three.

WinMerge 6.13

File content comparison in WinMerge
It works the same way as tkdiff, which puts it among the better ones. It uses nested windows, the way Opera used to work, yes, that web browser I once hopelessly loved, but ever since it went Chromium I have switched to Chrome.

CSDiff 1.31

File content comparison in CSDiff
It displays the output in an interesting way, which I find rather confusing, even chaotic. But it is the only one so far that works truly intelligently – it recognizes that lines probably belong together no matter what structure comes before them.

Beyond Compare 19.8

File content comparison in Beyond Compare
An absolutely fantastic app. It works the same way as Total Commander, but visually it is several steps further ahead. It automatically detects from the file extension what type of content it is dealing with – it supports a large number of script source files (C#, Java, … but not JavaScript, for example) as well as markup (HTML, XML), documents, and even registry branches. It is a fully functional 30-day trial, and it does not matter whether you have the Standard or the Pro features activated. You can read about the differences between them at https://www.scootersoftware.com/shop.php?zz=kb_editions .

If you want to keep using the application after 30 days, a license costs 30 USD for Standard and 60 USD for Pro. Minor updates (for example from 4.0.0 to 4.1.2) are free for life. As of today, 30 USD is on average about 2730 CZK – I am not sure, though, whether any additional commission fees are charged; this is just the product itself. It works with tabs, so you do not end up with 10 instances of the application open.

As for me – if I do not buy Beyond Compare, I will use KDiff3 whenever I have something in Windows Explorer (or in File Locator, which is another unbeatably amazing application), together with Total Commander. The only thing that puzzles me a bit is that diff-ext reverses the order of the files (for example, even though alphanumerically and in Explorer a.txt comes first and then b.txt, it compares them the other way around).

All it takes, however, is to swap the parameters slightly. For a 2-way comparison: "C:\Program Files\KDiff3\kdiff3.exe" "%2" "%1" And for a 3-way one: "C:\Program Files\KDiff3\kdiff3.exe" "%2" "%3" "%1" KDiff3 itself can also work without diff-ext, but with the file order swapped as described. I checked whether Total Commander has its own executable for comparison – it does not. Maybe it could be invoked with a certain parameter, but I will leave that for now.

If you know how to do it, feel free to write in the comments. For diff-ext itself, I recommend turning off the 3-way compare mode, because otherwise it adds 2 items for the same thing to the context menu of every file.

Categories

Leave a Reply