WinMerge is helpful for tasks such as determining how a project has changed since a previous release or migrating changes to a previous version. WinMerge can view differences in directory mode, displaying those files which have been changed from one version to the next, and allowing you to individually view and edit files that have been changed. It can also be used as a directory synchronization tool.
Most of what you will use in WinMerge can be found on the toolbar. The functions are also available via menu or keystroke. Here's a short description of each of the toolbar buttons.
Button | Description | Keystroke |
![]() |
Begins a new comparison session by displaying the Open dialog | Ctrl+O |
![]() |
Saves changes you have made in either file | Ctrl+S |
![]() |
Undoes the previous operation | Ctrl+Z |
![]() |
Redoes the previous operation | Ctrl+Y |
![]() |
Moves to the next difference in the open difference window | Alt+Down Arrow |
![]() |
Moves to the previous difference in the open difference window | Alt+Up Arrow |
![]() |
Moves to the last difference in the open difference window | Alt+End |
![]() |
Moves to the current difference in the open difference window | Alt+Enter |
![]() |
Moves to the first difference in the open difference window | Alt+Home |
![]() |
Copies the selected difference in the left file to the right file | Alt+Right Arrow |
![]() |
Copies the selected difference in the right file to the left file | Alt+Left Arrow |
![]() |
Displays WinMerge options | N/A |
![]() |
Copies all differences in the left file to the right file | N/A |
![]() |
Copies all differences in the right file to the left file | N/A |
![]() |
Refreshes the display, to show the current differences | F5 |
To start comparing files, click the
button, which displays the Open dialog, shown below.
The Open dialog has two fields that are used to specify what you would like to compare. You can specify comparison objects in one of four ways:
Note that if you enter and invalid path or a path to a single file in one field and a directory path in the other, WinMerge will disable the OK button.
Also, a recursive option is supplied when comparing directories, which will recursively compare the contents of each subdirectory as well.
You may specify which extensions you would like to compare using the Extensions field. To compare all files in the selected directories, leave the field blank, or enter *.*
If you want to specify multiple extensions, enter a semi-colon separated list of extensions such as the following:
*.cpp;*.hpp;*.c;*.h
You can drag and drop two files or two directories to the main window.
At the Command Line type:
winmerge [/r] [/e] [/ul] [/ur] [/ub] [leftpath] [rightpath] [outputpath]
where:
/r or -r tells WinMerge to compare directories recursively
/e or -e allows WinMerge to be closed with a single esc keypress
/ul or -ul tells WinMerge to not add left path to MRU
/ur or -ur tells WinMerge to not add right path to MRU
/ub or -ub tells WinMerge to not add both paths to MRU
leftpath is the directory or filename to open on the left side
rightpath is the directory or filename to open on the right side
outputpath is the output directory where you want merged files to be saved. Note that the correct syntax for the output path is something like C:\\Source\WinMerge
To simplify comparisons and using the parameters, it is recommended that WinMerge be added to the application path variable in Window's environment settings. Once that is done, WinMerge can be invoked from any directory instead of just the application's home directory.
Filter files can help with setting several filtering options at once for both file comparison and directory comparison. Save the code in an ASCII file with a *.flt extension. Filters can be selected for a comparison session by clicking on Options under the Edit menu, then clicking on the Filter tab. There you can select the file using the drop-down select field. Save the file into the Filters folder under the WinMerge application folder.
Here is an example of the code in a filter file:
## This is a directory/file filter for WinMerge ## This filter suppresses various binaries found in Visual C++ source trees name: Visual C++ loose ## This is an inclusive (loose) filter ## (it lets through everything not specified) def: include ## Filters for filenames begin with f: ## Filters for directories begin with d: ## (Inline comments begin with " ##" and extend to the end of the line) f: \.aps$ ## VC Binary version of resource file, for quick loading f: \.bsc$ ## VC Browser database f: \.clw$ ## VC class-wizard status file f: \.dll$ ## Windows DLL f: \.exe$ ## Windows/DOS executable f: \.exp$ ## VC library export file f: \\vc60.idb$ ## VC ? f: \.ilk$ ## VC incremental linker memory file f: \.lib$ ## compiled libraries f: \.ncb$ ## VC parser information file (class view & component gallery stuff) f: \.obj$ ## VC object module file f: \.pch$ ## VC precompiled header file f: \.pdb$ ## VC program database file (debugging symbolic information) f: \.sbr$ ## VC source browser file (used to create bsc file) f: \.res$ ## VC compiled resources file (output of RC [resource compiler]) d: \\cvs$ ## CVS control directory
You can find additional filter files to download at the WinMerge download site
If you have made some filters you would like to share with the rest of us, then please upload them as a WinMerge patch, then one of the developers will make sure they get on the download page.