Computer Hope

Other Pages

Home
Site map
Computer help

Dictionary
News
Q&A
What's new

Tools

E-mail this page
Print Preview
Edit this page



 

Microsoft DOS comp command

Quick links

About comp
Availability
Syntax
Examples

About comp

A simple compare that compares two or more files.

 

Availability

The comp.exe command is an external command and is available in the below Microsoft Operating Systems.

Windows 2000
Windows XP

Index

Category:
MS-DOS

Companies:
Microsoft

Related Pages:

 

Resolved

Were you able to locate the answer to your questions?

Syntax

Compares the contents of two files or sets of files.

COMP [data1] [data2] [/D] [/A] [/L] [/N=number] [/C]

data1 Specifies location and name(s) of first file(s) to compare.
data2 Specifies location and 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 only the first specified number of lines in each file.
/C Disregards case of ASCII letters when comparing files.

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

Examples

Note: Unless the /N option is used the comp command will only compare the size of the file.

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

Compares file1.txt with file2.txt. In this example we are using the /A option to display the ASCII characters that the compare has found different. If the /A option is not displayed, the comp command will display the differences in hexadecimal notation. Below is an example of how the comp command may display the comparison in this example.

Compare error at LINE 5
file1 = i
file2 = o
Compare error at LINE 5
file1 = v
file2 = u
Compare error at LINE 5
file1 = e
file2 = r
Compare error at LINE 6
file1 = s
file2 = f
Compare error at LINE 6
file1 = x
file2 = v
Compare error at LINE 6
file1 =
file2 = e
Compare error at LINE 7
file1 =

file2 =
Compare error at LINE 7
file1 =
file2 =

Compare error at LINE 8
file1 =

file2 = s

File1 only has 7 lines

 

Home - Computer help - Contact - Dictionary - Links
Link to Computer Hope - Bookmark Computer Hope