Techknow Study

COMP command in CMD

1:57:00 AM vikas 0 Comments Category :

Compare two files (or sets of files). And then display items which do not match.

      COMP [pathname1] [pathname2] [options]
      “if you are not in same directory”

      COMP [filename1] [filename2] [options]
      “if you are in same directory”

  1.  pathname1 The full path of first file’s

      2.  pathname2 The full path of second file’s


   [/D]          Display differences in decimal format.
                   {it is by default}

   [/A]          Display differences in ASCII characters.

   [/L]          Display line numbers for differences.

   [/N=number]   Compare only the first N number of lines
                            in the file.

   [/C]          do a case insensitive string comparison.

If you run COMP command without any parameters, it will ask first file to 
compare then after providing first file name. It will ask for second file 
name than option respectively.

To compare sets of files, use wildcards in pathname1 and pathname2 

When used with the /A option COMP is similar to the FC command but it 
displays the individual characters that differ between the files rather 
than the whole line.

COMP [pathname1] [pathname2] [/A]

To compare files of different sizes, use /N= to compare only the first 
n lines (common portion of each file.)

COMP [pathname1] [pathname2] [/N=number]

Normally COMP will finish with a Compare more files (Y/N) ?

provide answer  and proceed further.