Is there any way to diff two selected files from the context menu in Windows Explorer?


Sounds like you need diff-ext!

This shell extension (diff-ext) makes it possible to launch file comparison tool for 2 or 3 files (depending on the tool) in the same directory or "save" a file(s) for later comparison. It acts as external most recent used (MRU) file list for the comparison tool.

I'm using it with KDiff3, but there are a number of other diff tools on the page it can be used with.

alt text

  • You're more than welcome! – John T Feb 19 '10 at 20:27
  • Did not work well on my windows 7. I have configured it with the path to diff.exe and all I get is something blinking in front of my eyes. Is this application diff aware at all? – Anders Lindén May 26 '14 at 7:30
  • Works OK on Win7 but I'm using Meld as my diff tool. – JimFred Jun 30 '15 at 18:27
  • KDiff3 already has a context menu extension integrated now (Kdiff3 => Compare), so if you just need something quick & easy, that might be enough. – user121391 Sep 21 '16 at 7:58
  • I may have to give this a go, but I use exclusively gvim, so not sure how well that will turn out – Antony Apr 13 '17 at 23:15

Here's my solution to add a Right Click context menu entry to run a custom command (like calling Meld) and diff two files.

Background Simple context menu entries can be be easily added in Windows register (regedit): manually or by creating a .reg file (see example below).

The problem is that the command will be run for each file you select. There are three solutions to solve this:

  1. Use Shell extensions (complicated)
  2. Make sure your application catch the different calls (complicated)
  3. Use singleinstance.exe from context-menu-handler (simple). This program does option 2 for you. It collects arguments from the different time it is called and then pass these to the command you want. A time-out option is available to help gather calls to be collected. Follow the link for more info.

Step 1 Download singleinstance.exe from context-menu-handler (and thank the author, to whom I'm not related)

Step 2 (for file and folder comparison): Create a file with extension ".reg" with the following content (example for Meld with an Icon):

Windows Registry Editor Version 5.00

@="Diff it!"

@="\"c:\\Bin\\singleinstance.exe\" \"%1\" \"C:\\Program Files (x86)\\Meld\\Meld.exe\" $files --si-timeout 400"

@="Diff It!" 

@="\"c:\\Bin\\singleinstance.exe\" \"%1\" \"C:\\Program Files (x86)\\Meld\\Meld.exe\" $files --si-timeout 400"

The reg file create a context menu entry labelled "Diff It!" for all files (*) and for Folders (Folder). The lines containing the Icon can be removed if you don't want an icon.

Adapt the path of the program singleinstance.exe and the command run (here C:\Program Files (x86)\Meld\Meld.exe. Note the escaping of the backspaces and the quotes

Step 3 Run the .reg file. Double clicking on it might work if you are admin. Otherwise open an admin command prompt in your folder (in explorer: File>Open Command> Open Command as admin. or Alt-F-M-A). Simply Type the name of the .reg file to add it to the registry.

That's it.

(uninstall) You can either delete the keys manually in the registry or create a .reg file with the following content:

Windows Registry Editor Version 5.00



Alternative Use a software to add-edit-remove context menu entries like ContextEdit (but can't add icon easily). In this case you don't need to escape the slashes and the quotes so the command would look like this:

"c:\Bin\singleinstance.exe "%1" "C:\Program Files (x86)\Meld\Meld.exe" $files --si-timeout 400
  • Worked for me... – AnthonyVO Aug 17 '16 at 15:16
  • 1
    Overall, I like this implementation. However, sadly, it creates a new instance of Meld each time the context menu is used. Any tips for getting it to use the existing instance? I assume that was the intention of singleinstance.exe. Maybe it's not compatible with Windows 10. – Jim Fell Jun 25 '18 at 14:44

Beyond Compare and WinMerge can also do this if you enable Shell Integration during the installation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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