Name
File Compare (comp) —
\windows\system32\comp.exe
Synopsis
Compare the contents of two files (or sets of files) byte-by-byte and display the differences between them.
To Open
Command Prompt →
comp
Usage
comp [file1] [file2] [/n=number] [/c] [/offline] [/d] [/a] [/l]
Description
File Compare (comp.exe) compares two files (or
more, using wildcards), and reports whether or not the files are
identical. If the files are identical, comp.exe
will report Files compare OK. If the files are the
same size but have different contents, comp.exe
displays the differences, character-by character, by reporting
Compare Error at OFFSET
n (where n is
byte offset — the location of the difference, in characters, from
the beginning of the file). If the files are different sizes,
comp.exe reports Files are different
sizes, and the comparison
stops there.
Here are the options for comp.exe:
-
file1,file2 Specify the filenames of the files to compare. For any files that aren’t in the current directory, you’ll need to include the full path. If
file1includes a wildcard, all matching files are compared tofile2. Likewise, iffile2includes a wildcard, each matching file is compared tofile1. If one or both of these parameters are omitted,Comp.exewill prompt you for the files to be compared.-
/n=number Include the /n option to compare only the first specified number of lines in the files, or omit to compare the entire files. For example, specify
/n=5to check on the first five lines in each file.-
/c Disregard ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access