COMP file1 file2
Compares each file matching file1 (which can contain wildcards, but doesn’t match hidden files) with file2, or if file2 is a drive or directory, with the file there that has the same name.
For each pair of files, COMP displays their names, followed by the result. As in PC DOS, files of different sizes aren’t compared, and each difference is reported with its offset (in hex) and the byte from each file (also in hex), until 10 differences have been found.
COMP NAMES.TXT B:
NAMES.TXT and B:NAMES.TXT
Compare error at OFFSET 2
File 1 = 65
File 2 = 6F
COMP *.BAS B:
The results are:
Files compare okCompare error at OFFSET offset, followed by File 1 = and File 2 = lines with the bytes10 Mismatches - ending compare, after the tenth differenceFiles are different sizesUnable to find file, if file1 matches nothing or the file to compare with doesn’t existInvalid drive, if the drive of either file doesn’t existUnable to open both files (the same file?): a file that isn’t read-only can’t be compared with itself, since it can’t be opened twice for random accessUnable to compare (error n), for any other errorA switch, a missing file name, or a third file name displays Syntax error.
ERRORLEVEL is set to 0 if every file compares ok, and otherwise to 1.
Source: COMP.BAS
Copyright (c) 2020-2026 Jeff Parsons Released under MIT License