Introduction
Many of us use Windiff or a similar tool. But Windiff hasn't got a powerful user interface for selecting files and directories. So I integrated Windiff in the context menu of Windows Explorer and wrote a command script to handle the selection.
Install Windiff
Windiff is automatically installed with Visual Studio, usually under %ProgramFiles%\Microsoft Visual Studio\COMMON\Tools or %ProgramFiles%\Microsoft Visual Studio 8\Common7\Tools\Bin. You can also copy it from a Windows XP or Windows 2003 CS. Navigate to CD:\Support\Tools\SUPPORT.CAB, and copy windiff.* and gutils.dll to your preferred location on the hard disk.
Stub script
The stub script windiff.cmd handles the two arguments of files or directories. This script should be placed on a location where it can be found through the path variable. For example, %SystemRoot%. When windiff.cmd is called with two arguments, it checks if there are files or directories and appends a tailing \ for any folder. After that, it passes both arguments to windiff.exe.
So you can call windiff.cmd from a command shell directly. Example:
- Windiff.cmd file1 file2
- Windiff.cmd drive1 drive2
- Windiff.cmd folder1 folder2
- Windiff.cmd folder1\*.cpp folder2\*.cpp
The last example limits Windiff to compare only *.cpp.
When windiff.cmd is called only with one argument, it checks if this is the first or the second argument. The first argument is saved to %TEMP%\Windiff.arg. When %TEMP%\Windiff.arg exists, it is the second argument, and now both arguments can be passed to windiff.exe and the script deletes %TEMP%\Windiff.arg.
In the script, you must adapt the line SET WINDIFF_TOOL="%ProgramFiles%\Reskit\windiff.exe" to reflect the correct location for your windiff.exe.
Extend the Explorer context menu
You can add your own command and tools to the Windows Explorer context menu. The official documentation is 'Extending Shortcut Menus': http://msdn2.microsoft.com/en-us/library/bb776820(VS.85).aspx. I add the Windiff command to classes \*, classes\Drive, and classes\Directory. This can be done for all users on a computer under HKEY_LOCAL_MACHINE\Software\Classes or only for the current user under HKEY_CURRENT_USER\Software\Classes. In the download are two corresponding reg-files. Alternatively, you can deploy these settings with the group policy template WinDiff.adm to all desired users. Now you can right click the first file or directory in Windows Explorer and select Windiff. After that, you can right click the second file or directory in Windows Explorer and select Windiff, and Windiff is opened with the two arguments. When you select more than one file and click on Windiff, then the behavior is indefinite.
Similar projects
History
- 14.01.2008: Initial publication.