No announcement yet.

Automate Beyond Compare Text Comparison

  • Filter
  • Time
  • Show
Clear All
new posts

  • Automate Beyond Compare Text Comparison

    I have a purchased copy of BeyonCompare 3 and it does a great job

    I'm running beyond compare to mainly compare file such as pdf, csv,txt etc.Per day I'm comparing 50 files. I'm selecting the file path for 100 time. Therefore I need to automate the comparison process.

    I have the files stored in a folder. I want to write a program once given the folder location, which can automatically select the relevant files and and set the file path in BeyondCompare and does the comparison. The BeyondCompare comparison window should be visible as well.

    I would like to know is there a way I can access BeyondCompare 3 using a custom application and set parameters and invoke methods...???

    I'm running BeyondCompare 3 in Windows server 2008 64-bit

    Any help is appericated.

  • #2
    How would the "selection of relevant files" be expected to work? BC3 has a couple of methods of handling this.

    We could call a BCScript file using 2 parameters provided to us by the command line:
    bcompare.exe "@c:\bcscript.txt" "c:\file1" "c:\file2" "c:\bcreport.txt"

    Where this BCScript then generates a report of those two files:
    text-report layout:side-by-side output-to:"%3" "%1" "%2"

    This is documented in the Help menu -> Using Beyond Compare -> Automating with Script chapter.

    There is also the /qc command, which returns a DOS ErrorLevel on if the files are equal/different, documented in the Help menu -> Command Line Reference.

    Or are there two folders that can be lined up side by side (with equal file names on both sides) and the report could be generated on the folder level?
    Aaron P Scooter Software


    • #3
      Hi Aaron,

      I read the Automating Script chapter in the Help. Thanks for the tip.I tried executing the BCScript file using 2 parameters.But it failed.

      I created the 3 files; MyFile.txt,YourFile.txt and MyReport.txt in the E:\AutomateBCompare folder.

      This is how I executed it

      C:\Users\yasodaj\AppData\Roaming\Scooter Software\Beyond Compare 3\>BCompare.exe @"E:\AutomateBCompare\MyScript.txt" "E:\AutomateBCompare\MyFile
      .txt" "E:\AutomateBCompare\YourFile.txt" "E:\AutomateBCompare\MyReport.txt"
      I got this error
      'BCompare.exe' is not recognized as an internal or external command,
      operable program or batch file.
      Could you please give your opinion on this?
      Thanks in advance.


      • #4

        Where is your copy of Beyond Compare installed? The path to Bcompare.exe would need to be a full path to the executable, which is more likely located in:

        "C:\Program Files (x86)\Beyond Compare 3\BCompare.exe" "@E:\AutomateBCompare\MyScript.txt" "E:\AutomateBCompare\MyFile
        .txt" "E:\AutomateBCompare\MyFile.txt" "E:\AutomateBCompare\YourFile.txt" "E:\AutomateBCompare\MyReport.txt"
        Aaron P Scooter Software


        • #5
          Hi Aaron,
          Thanks for the reply.Bcompare was not installed properly
          Now it's working perfectly.

          One GUI I created to automate the comparison process is as follows (Screen.jpg)
          It lists all the matching files to be compared in a data grid.The each file pair (base case and new case) in a row will be compared.

          What I want to do is when i click on the View report button I want to open the BCompare window given in the BCompareScreen.jpg

          I'm using C# as my programming language.
          Could you be able to tell me how to achieve this..??


          • #6
            That screenshot looks like the main graphical interface. If you want the interactive GUI (and not a Report), you can call the command line:
            "C:\Program Files (x86)\Beyond Compare 3\BCompare.exe" "c:\basecase1.xlsx" "c:\newcase1.xlsx"

            Depending on where the actual files are, or where the command line is run from, you could use relative paths. This is documented in the Help file (F1) -> Command Line Reference chapter.
            Aaron P Scooter Software


            • #7
              Hi Aaron,
              Thanks alot

              I'm new to programming.So thank you for answering my silly questions


              • #8
                No problem. As a general tip, it is always best to test from the command line first - Windows' "Run" in the start menu, or WindowsKey+R: then type "cmd"; or launch the "Command Prompt" program. From here, you can test the command line calls by navigating to the necessary folder (by typing in the full path, or using "cd.." and other dos commands) and run the above command line to see if it launches the program as you expect.

                If so, you can then integrate it into other solutions.

                Good luck with your project.
                Aaron P Scooter Software