A sort of diff implementation in the MS-DOS world

The MS-DOS FC.EXE programs is useful to compare two files. Differences between files are shown introduced by the string “*****” otherwise, if the files are equal, no asterisks will are displayed.
Redirecting the output on a temporary file, using SET /P it’s possible to define a variable in order to handle both the cases (the files are different or the files are equals).

A sort of *nix diff implementation made by a batch script may be the following:

@echo off
fc %1 %2|find /c “*****” > tempfile.out
SET /P TestVar=<tempfile.out
del tempfile.out
echo TestVar=%TestVar%
if %TestVar% == 0 GOTO:FEQUALS
echo %1 and %2 are different
GOTO:EOF
:FEQUALS
echo %1 and %2 are equals

Off corse if You need something better of this silly diff version, You may find useful djcpp, cygwin or other unix-like platforms

Tags:

Leave a Reply