COMP
(from Compare)
Compares the contents of two files or groups of files. See the related command FCFC.
COMP [data1] [data2] [/D] [/A] [/L] [/N=number] [/C] [/OFF[LINE]] [/M]
Where:
data1
- Specifies the location and name of the first file to compare.data2
- Specifies the location and name of the second file to compare./D
- Displays differences in decimal format./A
- Displays differences in ASCII format./L
- Displays line numbers where differences occur./N=number
- Compares only the specified number of lines in each file./C
- Ignores the case of ASCII characters when comparing files./OFF[LINE]
- Does not ignore files with "offline" attribute./M
- Does not require comparing additional files at the end of the command execution (option introduced in new versions of Windows).
If one or both files to compare are omitted, the file names and also the options from the user input will be prompted. To compare groups of files, use wildcardswildcards in the data1
and data2
parameters.
Examples:
1. Compare the contents of the file C:\abc.txt
and the file C:\def.txt
, displaying the differences in ASCII format, and asking at the end if the user wants to compare other files:
comp "C:\abc.txt" "C:\def.txt" /a
2. Compare the first 5 lines of the file C:\my grandma.doc
and the file C:\my grandpa.doc
showing the differences in decimal format:
comp "C:\my grandma.doc" "C:\my grandpa.doc" /d /n=5 /m
3. Compare all files in the current directory with the file epic_rant.txt
:
comp * epic_rant.txt /m
Comments