MS-DOS and Windows command line comp command

Updated:
12/30/2021
by

Figurer Hope

The
comp
command allows users to compare two or more files.

Availability

Comp control is an external command available for the Microsoft operating systems listed below. In early versions of MS-DOS (4.0x and earlier), comp.com was used every bit the external file. All later versions of Windows use comp.exe as the external file.

  • MS-DOS 2.0x -v.x
  • Windows 2000
  • Windows XP
  • Windows Vista
  • Windows 7
  • Windows 8
  • Windows 10
  • Windows xi

Comp syntax

Windows x and Windows eleven syntax

Compares the contents of ii files or sets of files.

COMP [data1] [data2] [/D] [/A] [/L] [/North=number] [/C] [/OFF[LINE]] [/Yard]
data1 Specifies location and proper name(s) of offset file(s) to compare.
data2 Specifies location and proper noun(s) of second files to compare.
/D Displays differences in decimal format.
/A Displays differences in ASCII characters.
/Fifty Displays line numbers for differences.
/Northward=number Compares only the first specified number of lines in each file.
/C Disregards example of ASCII letters when comparing files.
/OFF[LINE] Do not skip files with offline attribute ready.
/M Practice not prompt for compare more files.

To compare sets of files, use wildcards in data1 and data2 parameters.

MS-DOS, Windows 2000, Windows XP, Windows Vista, Windows 7, Windows eight syntax

Compares the contents of two files or sets of files.

COMP [data1] [data2] [/D] [/A] [/L] [/Northward=number] [/C]
data1 Specifies location and name(south) of commencement file(south) to compare.
data2 Specifies location and proper name(s) of second files to compare.
/D Displays differences in decimal format.
/A Displays differences in ASCII characters.
/L Displays line numbers for differences.
/N=number Compares simply the first specified number of lines in each file.
/C Disregards case of ASCII letters when comparing files.
Popular:   Network card buying tips

To compare sets of files, use wildcards in data1 and data2 parameters.

Comp examples

Annotation

Unless the /N choice is used, the comp command only compares the size of the file.

comp file1.txt file2.txt /N=10 /A

Compares file1.txt with file2.txt. In this example, we use the /A pick to display the ASCII characters that the compare has found different. If the /A option is non displayed, the comp command displays the differences in hexadecimal notation. Below is an example of how the comp command may display the comparing in this example.

Compare error at LINE v
file1 = i
file2 = o
Compare error at LINE 5
file1 = v
file2 = u
Compare error at LINE 5
file1 = due east
file2 = r
Compare error at LINE half-dozen
file1 = south
file2 = f
Compare error at LINE 6
file1 = x
file2 = 5
Compare error at LINE 6
file1 =
file2 = e
Compare mistake at LINE 7
file1 =
file2 =
Compare error at LINE 7
file1 =
file2 =
Compare mistake at LINE viii
file1 =
file2 = s
File1 only has 7 lines