CmdID

CmdID / Commands

comp

Compares the contents of two files or sets of files byte-by-byte. Windows commands reference

On Windows File comp.exe

Opens CmdID with your command. It is read in your browser and sent nowhere.

Windows

from the Windows commands reference, CC BY 4.0

Compares the contents of two files or sets of files byte-by-byte. These files can be stored on the same drive or on different drives, and in the same directory or in different directories. When this command compares files, it displays their location and file names. If used without parameters, comp prompts you to enter the files to compare. - During the comparison, comp displays messages that identify the locations of unequal information between the files. Each message indicates the offset memory address of the unequal bytes and the contents of the bytes (in hexadecimal notation unless the /a or /d command-line parameter is specified). Messages appear in the following format: After ten unequal comparisons, comp stops comparing the files and displays the following message: 10 Mismatches - ending compare - If you omit necessary components of either data1 or data2, or if you omit data2 entirely, this command prompts you for the missing information. - If data1 contains only a drive letter or a directory name with no file name, this command compares all of the files in the specified directory to the file specified in data1. - If data2 contains only a drive letter or a directory name, the default file name for data2 becomes the same name as for data1. - If the comp command can't find the specified files, it will prompt you with a message about whether you want to compare additional files. - The files that you compare can have the same file name, provided they're in different directories or on different drives. You can use wildcard characters (* and ?) to specify file names. - You must specify /n to compare files of different sizes. If the file sizes are different and /n isn't specified, the following message is displayed: To compare these files anyway, press N to stop the command. Then, run the comp command again, using the /n option to compare only the first portion of each file. - If you use wildcard characters (* and ?) to specify multiple files, comp finds the first file that matches data1 and compares it with the corresponding file in data2, if it exists. The comp command reports the results of the comparison for each file matching data1. When finished, comp displays the following message: Compare more files (Y/N)? To compare more files, press Y. The comp command prompts you for the locations and names of the new files. …

comp [<data1>] [<data2>] [/d] [/a] [/l] [/n=<number>] [/c]

To compare the contents of the directory c:\reports with the backup directory \\sales\backup\april, type

comp c:\reports \\sales\backup\aprilIdentify

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

comp \invoice\*.txt \invoice\backup\*.txt /n=10 /dIdentify
/nCompares only the number of lines that are specified for each file, even if the files are different sizes. Windows commands reference
/dDisplays differences in decimal format. Windows commands reference
<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.
/dDisplays differences in decimal format. (The default format is hexadecimal.)
/aDisplays differences as characters.
/lDisplays 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.
/cPerforms a comparison that is not case-sensitive.
/off[line]Processes files with the offline attribute set.
/?Displays Help at the command prompt.

Windows

from tldr-pages, CC BY 4.0

Compare the contents of two files or sets of files. Use wildcards (*) to compare sets of files.

Compare files interactively

Compare two specified files

comp path\to\file1 path\to\file2Identify

Compare two sets of files

comp path\to\directory1\* path\to\directory2\*Identify

Display differences in decimal format

comp /d path\to\file1 path\to\file2Identify
/dDisplays differences in decimal format. Windows commands reference

Display differences in aSCII format

comp /a path\to\file1 path\to\file2Identify
/aDisplays differences as characters. Windows commands reference

Display line numbers for differences

comp /l path\to\file1 path\to\file2Identify
/lDisplays the number of the line where a difference occurs, instead of displaying the byte offset. Windows commands reference

Compare files case-insensitively

comp /c path\to\file1 path\to\file2Identify
/cPerforms a comparison that is not case-sensitive. Windows commands reference

Compare only the first 5 lines of each file

comp /n=5 path\to\file1 path\to\file2Identify
/nCompares only the number of lines that are specified for each file, even if the files are different sizes. Windows commands reference