Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2014

    Default 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.

  2. #2
    Join Date
    Oct 2007
    Madison, WI



    If you can process ErrorLevel codes, you could use " /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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts