Don't you just love utilities with expressive names such as Windiff? The words Windows and Difference lead us to the concept of to comparing files and highlighting and disparity. As with other tools, the
benefit of Windiff comes from imagining scenarios when it would solve your problems.
To get your copy of Microsoft's Windiff, either extract it from the Windows Server 2003 Support folder, or else download a free copy at the bottom of this page.
Judging from my postbag, not many people realize the benefits of comparing files with Windiff. However, like the all the best ideas, once you understand the concept it becomes blindingly obvious.
Let us take the situation where we want to find a particular setting in the registry, for example, a setting on the Winlogon message box that we wish to control. Here is the outline of our plan:
Before you make any changes, export the registry with Regedit.
Make the change, for example, remove the tick from a checkbox.
I find that while Windiff is easy to get working, nevertheless, it leaves me with that lingering feeling that I never quite reach the bottom of its possibilities. For example, I rarely use Windiff for copying files. Windiff
has two main modes: Compare files Compare directories
Let us start with Windiff's number one job, comparing files.
When you first launch Windiff, be aware of a pair of almost identical menus. Go slowly. Be ready for Windiff to ask for the name of the two files in quick succession. I emphasise this sequence because when I was a greenhorn, I thought either
I was going mad, or Windiff had a bug. My salvation was reading the screen, Select First File, then Select Second File - phew it's that easy to get started.
Once you have loaded the two files, I expect you want Windiff to identify the differences. The trick is to click on 1 .\filename and then click on Expand.
As ever, Microsoft provide two ways of doing everything, and you could click on the Expand Menu and then select, 'Both files'.
At the business end, Windiff homes in on every tiny difference between the two files. Moreover, for easy reading, it highlights each difference with a different color. The color coding extends into the margin so you can see which file
corresponds to the red highlight and which to the yellow highlight.
If a line is the same in both files it only has one entry, which you see in normal black text. Where there are differences, not only do you have the exceptions highlighted, but it gives you the line number.
The screen shot is taken from a regedit export. As I mentioned earlier, one of my classic uses of Windiff is finding where in the registry Microsoft store particular settings.
Guy Recommends: A Free Trial of the Network Performance Monitor
(NPM)
SolarWinds'
Network Performance Monitor
will help you discover what's happening on your network. This
utility will also guide you through troubleshooting; the dashboard will
indicate whether the root cause is a broken link, faulty equipment or
resource overload.
Perhaps the NPM's best feature is the way it suggests solutions to network
problems. Its second best feature is the ability to monitor the health of individual VMware
virtual machines. If you are interested in troubleshooting, and creating network maps, then I recommend that you
give this Network Performance Monitor a try.
After doing its best to match the files line-by-line, Windiff looks at the remaining parts. Where there are sections which are different, but which correspond, in the sense that the part before and the part after match, Windiff has a choice between displaying the lines as blocks or as interleaved.
Windiff uses a heuristic intelligence to decide whether the lines from the two files are similar. If it judges that they are similar it displays them interleaved, otherwise it displays them as blocks.
A secondary job for Windiff is to compare whole folders or directories. Just click on the File menu and select 'Select Directories'. This time you see both directories one under the other so there is
no chance of confusion.
Press F8 to see the next change / difference.
Windiff Options
Although there is nothing really exciting in the Options menu, they are worth checking. For example, if you remove the tick next to 'Show Identical Lines, it will help you track a single change in large
files. In addition to the options, check out the Expand menu and decide if you need to add or remove any of those options.
Windiff's Mark Menu
It is easy to overlook the Mark menu. The job of this menu is to hide or exclude files in your search.
Windiff Command Line Options
My old friend 'Barking' Eddie insisted that I added this Windiff command line section. As I may have mentioned in previous Eddie is an ex-UNIX man and is a founder of 'Dos Diehards'.
Windiff Command Line Options:
-D Compare one directory only. -F[flags] savefile Save composite file to 'savefile'. The 'flags' may consist of one or more of I (identical), L (left), R (right),
F (moved leFt), G (moved riGht), S (Similar left), A (similiAr right), X (exit after saving list). (e.g. -FLF saves list of Left or moved-leFt lines). -I file Reads list of files to compare, from the
specified input file. Each line can contain one or two filenames, space delimited (with quoting, if filenames contain spaces). Use "-" as the filename to read from stdin. If a line contains only one filename,
the file is compared to itself. -N name NET SEND notification to 'name' at end of comparison. -O Outline view (no automatic expansion). -P Perverse comparison: breaks lines on punctuation. -S[flags]
savefile Save list of files to 'savefile'. The 'flags' may consist of one or more of S (same), L (left), R (right), D (different), X (exit after saving list). (e.g. -SLD saves list of Left or Different
files). -T Compare whole subtree.
Guy
Recommends:
SolarWinds Free Network Bandwidth Monitor
This freeware monitor is great for checking whether your network's load-balancing is performing as
expected, for example, are two interfaces are getting about equal
traffic?
It's easy to install and straightforward to configure. You will
soon be running tests to see how much network bandwidth your
applications consume.
The GUI has a lovely balance between immediate network traffic data in
the middle, combined with buttons to seek related data and configuration
settings. Give this monitor a try, it's free!
Here is a PowerShell equivalent of Windiff compare files. As a vehicle
to test this script, let us pretend that you have a shopping list.
Preparation We need two files, the first is for reference and the second for comparison. Let
us use a shopping list for our test scenario. The file called ShopList.txt
is a list of goods we need to buy at the supermarket. Checkout.txt, is a
list of what we actually purchased.
ShopList: Save these 10 items into a text file, I called mine
C:\temp\ShopList.txt
Now we are ready to execute this Compare-Object script. My favoured method is to save
these instructions into a cmdlet with a .ps1 extension, then call the file from
the PowerShell command line. Alternatively, copy the following lines and
then paste into the command line.
# Microsoft PowerShell Compare-Object Example
# Author: Guy Thomas
Clear-Host
$strReference = Get-Content "C:\Temp\ShopList.txt"
$strDifference = Get-Content "C:\Temp\Checkout.txt"
Compare-Object $strReference $strDifference
Note 1: You could add the explicit parameters: -referenceObject
-differenceObject and thus substitute this for the last line of Example
1:
Compare-Object -referenceObject $strReference -differenceObject $strDifference
The reason that I omit these positional parameters is that PowerShell can
deduce what to compare from the sequence.
Note 2: If your script fails, then check a) The names of the two files, b) They are in the folder referenced by your script.
Challenge 1: You could add the -includeEqual parameter and
thus display all the items that you bought that were on the original list.
=> Means the InputObject is present in the difference (second) file, but not in the first file.
In this scenario it means we bought stuff, which was not on the
original list.
<= Present in reference (first) file, but not in the second file. In my
analogy, we forgot to buy this item on our shopping list.
== Present in both files. Try my challenge and add the -includeEqual parameter,
then you will see this
double-equals underneath 'SideIndicator' in the output.
Windiff is a handy utility for comparing files and highlighting differences. My 'killer' use for Windiff is discovering where menu settings correspond to registry values. Another job for Windiff is
checking directories and reporting and differences in the file lists.
If you like this page then please share it with your friends
Guy Recommends:
SolarWinds' NPM - Network Performance Monitor
SolarWinds' performance monitor is designed for detecting network outages,
making it easy to see what's working, and what needs your attention.
This utility guides you through creating network maps; it also helps
identifying whether the
root cause is faulty equipment, or resource overload. Give NPM a try.