Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 3 down vote accepted

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

share|improve this answer
    
Thanks chief! :-) – leeand00 Feb 19 '10 at 20:18
    
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

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

share|improve this answer

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 the register: 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

[HKEY_CLASSES_ROOT\*\shell\DiffIt_Files]
@="Diff it!"
"Icon"="C:\\Config\\look\\Icons\\Meld.ico"

[HKEY_CLASSES_ROOT\*\shell\DiffIt_Files\command]
@="\"c:\\Bin\\singleinstance.exe\" \"%1\" \"C:\\Program Files (x86)\\Meld\\Meld.exe\" $files --si-timeout 400"

[HKEY_CLASSES_ROOT\Folder\shell\DiffIt_Folders] 
@="Diff It!" 
"Icon"="C:\\Config\\look\\Icons\\Meld.ico"

[HKEY_CLASSES_ROOT\Folder\shell\DiffIt_Folders\command]    
@="\"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

[-HKEY_CLASSES_ROOT\*\shell\DiffIt_Files]

[-HKEY_CLASSES_ROOT\Folder\shell\DiffIt_Folders] 

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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