Quickly compare 2 files automatically

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JackyJay
    New User
    • Jul 2014
    • 1

    Quickly compare 2 files automatically

    Hi everybody,
    I try to compare 2 files with Beyond compare using Matlab. Actually that is quite easy. The problem is, that Beyond compare does not close itself. I always have to close it by my own.

    My code in Matlab looks like:

    dos('"C:\Beyond Compare 3\BCompare.exe" "file1.txt" "file2.txt"')

    Now I have to close Beyond Compare by my own. When the two files are equal I get 1 as my output, when they differ I got 0. But I want that automatically. I tried:

    dos('"C:\Beyond Compare 3\BCompare.exe" /closescript "file1.txt" "file2.txt"')

    But this does not work. Does anybody has an idea? I only want to know in an easy way, if both files are equal.

    Thank you in advance.
  • Aaron
    Team Scooter
    • Oct 2007
    • 16009

    #2
    Hello,

    If you can process ErrorLevel codes, you could use "Bcomp.com /qc "file1" "file2". This would return an %ErrorLevel% (documented in the Help file -> Command Line Reference chapter, at the bottom).

    If you want to launch the GUI, you'll then need to process the error level, and recall bcompare file1 file2.

    Calling Bcompare with two files is not scripting mode; that's just a method to launch the graphical interface into a specific compare type, which is why we don't close automatically. BC scripting is technically done with @scriptfile.txt as the parameter, which can then be used to generate a Report .txt or .html, sync files, or other automated actions.
    Aaron P Scooter Software

    Comment

    Working...