Results 1 to 10 of 10
  1. #1
    Guest

    Default 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. #2
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    4,771

    Default 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

  3. #3
    Join Date
    Dec 2008
    Posts
    2

    Default

    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

  4. #4
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    2,529

    Default

    ZoŽ P Scooter Software

  5. #5
    Join Date
    Dec 2008
    Posts
    2

    Default

    Perfect! Thanks very much Craig...great response time.

    Bill

  6. #6
    Join Date
    Mar 2015
    Posts
    2

    Default

    How do we accomplish this in BC3?

  7. #7
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,953

    Default

    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

  8. #8
    Join Date
    Oct 2015
    Posts
    12

    Default

    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?

  9. #9
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,953

    Default

    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 at 12:02 PM. Reason: Suggestion to remove silent flag
    Aaron P Scooter Software

  10. #10
    Join Date
    Oct 2015
    Posts
    12

    Default

    Thanks Aaron! Appreciate your response

Posting Permissions

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