beyondcomparebeyondcompare4

Simple command line to compare files with ignore line endings


Where can I find example command lines for Beyond Compare 4? I do not find them in the product help information.

I want to compare two (2) files with ignore line ending differences. I do not want a GUI to appear. I just want to get the exit code.

What am I missing? I was expecting the exit code of the second compare to be non-zero.

 Directory of C:\src\ttt

2019-01-09  13:26               290 t.txt
2019-08-09  09:21                18 u.txt
2020-07-24  16:22                28 w.txt

C:\src\ttt>"C:\Program Files\Beyond Compare 4\bcompare.exe" /quickcompare t.txt t.txt
C:\src\ttt>ECHO %ERRORLEVEL%
0
C:\src\ttt>"C:\Program Files\Beyond Compare 4\bcompare.exe" /quickcompare t.txt w.txt
C:\src\ttt>ECHO %ERRORLEVEL%
0

Solution

  • To compare two files from the command line using Beyond Compare, then return rules-based comparison results as an exit code, use the /quickcompare command line argument.

    bcomp.com /quickcompare file1.txt file2.txt
    

    Beyond Compare 4 Help - Command Line Reference

    /qc=, /quickcompare=

    Performs a quick comparison of two files and sets the DOS error level on exit. The specified type can be size, crc, or binary. If a type is not specified, a rules-based comparison will be performed. Error levels are documented below.

    Return codes

    0 Success 1 Binary same 2 Rules-based same 11 Binary differences 12 Similar 13 Rules-based differences 14 Conflicts detected 100 Unknown error 101 Conflicts detected, merge output not written 102 BComp.exe unable to wait until BCompare.exe finishes 103 BComp.exe cannot find BCompare.exe 104 Trial period expired 105 Error loading script file 106 Script syntax error 107 Script failed to load folders or files