CMP will compare text or binary files (or groups of files) and report any differences. Output is suitable for piping, or processing by other programs. A value returned in ERRORLEVEL lets batch files take action based on whether files are the same or differ.
This document is the complete revision history, starting with the most recent changes. For user instructions, please see the separate user guide.
This is a minor release.
By user request, "file not found" messages
/C
option) are now
written to both standard output and standard error, if you redirected
standard output to a report file. Also by user request, when you
append debug output to an existing
file, a prominent header separates new output from previous output.
Other minor improvments to debug output include a clearer list of
filespec arguments, for help in diagnosing possible user errors on the
command line.
This is a minor release. It adds one feature: when comparing multiple files, CMP now tells you at the end how many pairs were the same, how many pairs were different, and how many sought files were missing.
One line of the help message was 82 characters long; now it isn't.
This is a very minor release, for one new feature: CMP now tells you not only how many blocks of lines were different between the two files, but also how many actual lines were different.
new feature:
The /C
option makes CMP warn
you about missing files.
(Previously, a small subset of warnings appeared by default and could
be turned off with the /Q3
option,
but there was no way to get warnings for most missing files without
weeding through the large output of the /D
option.)
The old behavior was equivalent to /C0
with the
/S
option and /C1
without the /S
option.
bugs fixed:
When the first file spec contained a wild card, and the first physical entry in the directory was a subdirectory that matched the wild card, CMP might not find all files that actually matched.
(CMP16 only) When the first file spec was a directory, CMP16 ignored files with an extension (that is, the program expanded dir\* instead of dir\*.*). This did not affect CMP32.
When a line was added or deleted at end of file, and UNIX output was selected, the line number displayed for the other file was off by 1.
CMP 5.0 was a complete rewrite of the program from scratch. The program is about 40 pages of code, compared to about 14 pages for the previous release, CMP 4.3! The executables are still comfortably small, under 90 KB for CMP32 and 60 KB for CMP16.
If you used CMP 4.3 or earlier, please see the Transitional Note below.
The new program can handle binary files, can search subdirectories, displays results in your choice of formats, and makes better use of available memory; details are listed below. The user guide has been very greatly revised and expanded, and this revision history has become a separate document. A demo has been added to display some of CMP's features.
New options:
/R
option allows
comparison of binary files.
/S
option compares files
in subdirectory trees.
/U
option displays
results in UNIX diff format.
/L
option now lets you specify the number of lines necessary to
resynchronize. This should make for much more useful comparison
reports. (The Transitional Note gives more
information.)
/A
option lets you limit
the number of difference blocks reported.
/2
option
always puts the older file first and new file second in comparisons.
Old options enhanced:
/Q
option now takes a
numeric parameter, for finer control on the quantity of messages.
/D
option now takes an
optional file name for debug information, and the program makes much more
information available.
/F
option now allows
additional formatting choices.
Other enhancements:
/M
option displays
the massaged lines instead,
if you prefer the old behavior.)
/L
option
and /W
option) have been
increased in CMP16. Previously, the buffer was limited to
65 KB; now it can use all available DOS memory. (CMP32 has always
used virtual memory, effectively unlimited.)
If you are upgrading from CMP 4.3 or earlier, please note that certain options have changed their meanings. This section points them out and tells you how to retain the old behavior if you want to.
If you use the ORS_CMP
environment variable
to store options, make sure to check it and
see whether you need to make changes.
Please see What's New in CMP 5 for a number of new options and other enhancements.
/B
, /E
, /T
The /B
option and
the /E
option
now default to the opposite of their old settings.
Formerly, if you did not specify any options, CMP would do some
massaging of the file lines
before comparing. Now, by default CMP compares files character for
character.
If you want the old behavior, you can get it easily. For individual
runs of CMP, specify the
/BE
options on the command line. If you simply want to
restore the old defaults, you can use the
environment variable. Put this command in your
AUTOEXEC.BAT file:
set ORS_CMP=/BE
In this case, you may want to consider the new
/M
option as well.
The /T
option has been withdrawn. It allowed you to expand
tabs to an equivalent run of spaces, but this was redundant with the
/B
option.
/L
CMP 4.3 and earlier would consider that files were resynchronized after a difference block as soon as it found a line in file 1 that matched a line in file 2. If you edited every other line of a paragraph or block of code, you would get a lot of little difference blocks.
To avoid this, CMP now requires two consecutive identical lines
before it considers a difference block to have ended. Though that will
usually give a more usable report that the old default, it's
not be the best choice for every comparison. You can now use the
/L
option to increase or
decrease that value. This flexibility should let you get much better
difference reports for many sets of files.
If you want to restore the old behavior as the default, you can use an environment variable. Put this command in your AUTOEXEC.BAT file:
set ORS_CMP=/L,1
Note that comma after the letter L.
/Q
, /QQ
The /Q
option has changed
from a pure toggle to a numeric, /Q0
through
/Q3
. You will still get the old behavior if you type
/Q
or /QQ
.
Because you can combine options, one particular combination has
changed its meaning.
/Q1
or /Q0
used to mean
the /Q
option followed by the
/1
option or the
/0
option; now it means the
/Q
option setting quietness level 1 or 0. To specify
separate options, simply use a slash or hyphen between them, or
specify them in the other order: /Q/1
or /1Q
.
/M
Before release 5.0, CMP would transform ("massage") the input lines to collapse runs of blanks. To conserve computer memory, CMP would store and display only the massaged lines. Then when CMP reported differences, it would display the massaged lines, which would be similar to the lines in the files but not necessarily identical.
Beginning with release 5.0, CMP saves both the massaged and the
original lines, and displays the original lines. If you want to
display the massaged lines, use the
/M
option. If you want
that behavior to be the default, you can use the
environment variable. Put this command in your
AUTOEXEC.BAT file:
set ORS_CMP=/M
This is less of an issue than it was before CMP 5.0. In
earlier releases of CMP, lines were
massaged unless you set options to prevent it. Now, lines are not
massaged unless you set /B
option
or the /I
option. So if you set no
options at all, CMP 5.0 will display difference lines exactly
as they are in the files, which is probably what you'd expect.
This section is of only historical interest, since the program was completely rewritten in February 2001. But some users have said they find a complete revision history interesting, so here it is.
/Z option
;
updated the logo message to use the URL for Oak Road Systems; expanded
the help message; suggested "cmp /?|more" when the user types
cmp
with no files.
CMP 4.3a, 24 Aug 2000, updated the user guide but did not change the
program.
It clarified the ERRORLEVEL returns with the
/1
and /0
options when
multiple files are compared.
It also spelled out the limitation that CMP
couldn't be used for binary files; that capability was added in
CMP 5.0.
/F option
,
the /N option
,
and the /QQ option
; sent
the help message to stdout instead
of stderr as previously; reorganized the user guide, adding
many hyperlinks and a few small clarifications.
/I
and
/D
options. Split the
confusing three-valued /B
n option into separate
/B
and
/T
toggle-type options. (The /T
option was
dropped from release 5.0.) Changed the
CMP32 default to /L100
.
Improved
diagnostics for a bad option in the environment variable. Converted
documentation to HTML from Word for Windows.
Two minor releases involved no changes to the program or user guide. Version 4.1a, 20 Feb 1999, updated contact information when Oak Road Systems changed Internet providers. Version 4.1b, 4 Aug 1999, updated contact information when we changed physical addresses; it also simplified the registration options and added site license pricing.
CMP 4.0 was packaged on 18 Nov 1998 for the first shareware release.
/0
and
/1
options; systematized
all return values. Stopped requiring the trailing backslash on a
directory argument. Instead of "effectively identical", reported a more
specific phrase when the files are not significantly different based
on the /B
option and the
/E
option.
/B
option to control that feature and tab expansion.
Added
the /Q
option. Made the format of
command-line options more flexible, and scanned the
ORS_CMP
environment variable for options.
/L
and
/W
.
/L20
(previously /L10
).