Announcement

Collapse
No announcement yet.

Using BC with Command line scripting

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using BC with Command line scripting

    I need to generate a comparison file for a number of file (150-200). So i have written a command line script to compare these many file and generate a html report for the same. It is a very simple script as given below:

    load "C:/temp/XmoDiff/master" "C:/temp/XmoDiff/second"
    filter "*.xmo"
    expand all
    select all
    file-report layout:side-by-side options:line-numbers output-to:"C:/temp/XmoDiff/compare_report.html" output-options:html-color

    What is need is, is it possible to get a retrurn value such as a bool value or some numeric value like 0 - Files match
    1 - Files do not match?
    My main aim is it generate also a log report which would show which are the files that match and which do not.

    Quick reponse would be helpful.

    Thanks in advance,
    Shruthi

  • #2
    Re: Using BC with Command line scripting

    Shruthi,

    It isn't possible to get a return value for the comparison result using scripting.

    However, Beyond Compare includes a command line comparison utility named BCQC.EXE that will return a comparison result as a dos error level.

    Running BCQC.EXE on the command line without arguments gives the usage information:

    QuickCompare for Beyond Compare 2
    Copyright (c) 2005 Scooter Software, Inc.

    Syntax: bcqc [options] filename filename

    Options:
    /size, /s = size-only comparison
    /crc, /c = CRC32 comparison
    /binary, /b = binary comparison
    /rules[=rules name], /r = rules-based comparison
    /selftest = run a self test (omit filenames)

    The /rules switch can optionally include the name of an
    existing rules set. If the rules name is omitted the rules
    will be picked automatically based on the file names.

    Comparison result is returned as the DOS ErrorLevel
    0 = files match
    1 = files only contain unimportant differences
    2 = files do not match
    3 = error, result unknown
    Chris K Scooter Software

    Comment


    • #3
      This is exactly what I am looking for, however, in c:\Program Files\Beyond Compare2 directory on my system there is no bcqc.exe file and the installation does not prompt for select a specific type of install. Where can I get this utility? I couldn't readily see it available as a download from the website.

      Thanks
      Bill

      Comment


      • #4
        http://www.scootersoftware.com/bcqc.zip
        ZoŽ P Scooter Software

        Comment


        • #5
          Perfect! Thanks very much Craig...great response time.

          Bill

          Comment


          • #6
            How do we accomplish this in BC3?

            Comment


            • #7
              Quick Compare is built into BC3 and BC4 as a command line parameter:
              bcompare.exe /qc "c:\file1" "c:\file2"

              Which will return a code to the %ErrorLevel% of the comparison results.
              Aaron P Scooter Software

              Comment


              • #8
                Pardon my ignorance but what do you mean by - %ErrorLevel% of the comparison results.? When I run a compare something like this using batch file or command line
                Bcompare.exe /silent /qc @"C:\BC\SampleScript.txt" "C:\BC\SourceFile.xlsx" "C:\BC\TargetFile.xlsx" "C:\BC\Diff2.html", how cn I catch the return code?

                Comment


                • #9
                  Running in @script mode and running /qc are two different actions. You can either run in script mode and generate a report, or run with /qc to generate a return code.

                  For /qc, an example for running on the command line could be:
                  bcomp.com /qc "c:\file1.txt" "c:\file2.txt"
                  then
                  echo %ErrorLevel%

                  An example script would be:
                  Bcompare.exe "@C:\BC\SampleScript.txt" "C:\BC\SourceFile.xlsx" "C:\BC\TargetFile.xlsx" "C:\BC\Diff2.html"


                  Also, please remove /silent while testing automation. /silent will suppress all messages and feedback, even error messages. Once your automation is running smoothly and as expected you can add /silent back in.
                  Last edited by Aaron; 12-Oct-2015, 01:02 PM. Reason: Suggestion to remove silent flag
                  Aaron P Scooter Software

                  Comment


                  • #10
                    Thanks Aaron! Appreciate your response

                    Comment

                    Working...
                    X