Comp


Applies To: Windows Server 2008,Windows Vista

Compares the contents of two files or sets of files byte-by-byte. If used without parameters, comp prompts you to enter the files to compare.

For examples of how to use this command, see Examples.

Syntax


Copy Code

comp [<Data1>] [<Data2>] [/d] [/a] [/l] [/n=<Number>] [/c]

Parameters

Parameter

Description

<Data1>

Specifies the location and name of the first file or set of files that you want to compare. You can use wildcard characters (* and ?) to specify multiple files.

<Data2>

Specifies the location and name of the second file or set of files that you want to compare. You can use wildcard characters (* and ?) to specify multiple files.

/d

Displays differences in decimal format. (The default format is hexadecimal.)

/a

Displays differences as characters.

/l

Displays the number of the line where a difference occurs, instead of displaying the byte offset.

/n=<Number>

Compares only the number of lines that are specified for each file, even if the files are different sizes.

/c

Performs a comparison that is not case-sensitive.

/off[line]

Processes files with the offline attribute set.

/?

Displays Help at the command prompt.

Remarks

Examples

To compare the contents of the directory C:\Reports with the backup directory \\Sales\Backup\April, type:


Copy Code

comp c:\reports \\sales\backup\april

To compare the first ten lines of the text files in the \Invoice directory and display the result in decimal format, type:


Copy Code

comp \invoice\*.txt \invoice\backup\*.txt /n=10 /d

Additional references

Command-Line Syntax Key