Page 1 of 3 123 LastLast
Results 1 to 10 of 21
  1. #1
    Join Date
    Apr 2017
    Posts
    14

    Default Multiple Compares at once ?

    I'm new to BC and it's extensive feature list can be a bit, um, overwhelming. But that's a good thing

    I need to figure out a way to perform 8 compares automatically.

    In short, I have a set of batch files and scripts that create up to 14 USB Thumb Drives with corporate windows image installers. My tech's use these to image machines.

    The automated creation of the keys is all set and I've created 1000's of drives without issue.

    The problem comes with verification/quality control which is a pain in the arse to do in cmd line.

    So I purchased BC.

    I can work it fine to verify each key one at a time. Just compare folders, source on the left, usb drive on the right, and away it goes.

    But what I want it to do is check all of the drives automatically (via commands added to my batch file) after they are created.

    Now, I know I can type "bcompare C:\GLSource e:" and it will compare my source folder to the drive in E: The problem is it sits there with the open window when done.

    What I need it to do is run the compare and close. I'll then examine the errorlevel to verify that drive is ok.

    In it's simplest form, the batch command would look something like this:

    bcompare C:\GLSource e:
    <code to check errorlevel>

    bcompare C:\GLSource f:
    <code to check errorlevel>

    bcompare C:\GLSource g:
    <code to check errorlevel>

    bcompare C:\GLSource h:
    <code to check errorlevel>

    bcompare C:\GLSource i:
    <code to check errorlevel>

    bcompare C:\GLSource j:
    <code to check errorlevel>

    bcompare C:\GLSource k:
    <code to check errorlevel>

    bcompare C:\GLSource l:
    <code to check errorlevel>

    bcompare C:\GLSource l:
    <code to check errorlevel>

    bcompare C:\GLSource m:
    <code to check errorlevel>

    bcompare C:\GLSource n:
    <code to check errorlevel>

    bcompare C:\GLSource o:
    <code to check errorlevel>

    bcompare C:\GLSource p:
    <code to check errorlevel>

    bcompare C:\GLSource q:
    <code to check errorlevel>

    bcompare C:\GLSource r:
    <code to check errorlevel>

    "<code to check errorlevel>" is where I would check the returned errorlevel after each run of the program and if it's not 0 (which is all I care about) notify me in a manner I'll work out.

    How can I accomplish this? I can't find a switch to close the program after each run.

    If there is a much simpler way to do this, I'm all ears !!!

    Thanks

  2. #2
    Join Date
    Oct 2014
    Posts
    6

    Default

    Did you try typing EXIT as the last line in your batch file?

    http://www.robvanderwoude.com/exit.php

  3. #3
    Join Date
    Apr 2017
    Posts
    14

    Default

    Quote Originally Posted by sunk818 View Post
    Did you try typing EXIT as the last line in your batch file?

    http://www.robvanderwoude.com/exit.php
    At the end of the batch file, yes.

    What I can't seem to do is get BCOMPARE to exit between each comparison of each drive. It just leaves the screen on the desktop.

  4. #4
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,918

    Default

    Hello,

    Launching with two folder inputs is designed to open and compare the two folders. It isn't part of our automation to return an errorlevel for folder pairs (although, it is for *file* pairs if using /qc).

    For folders, you'll want to use scripting, documented in the Help file -> Using Beyond Compare -> Scripting chapter, or the main Scripting Reference chapter. This is executed with something like:
    bcompare.exe "@c:\bcscript.txt" "C:\GLSource" "r:" "c:\reports\bcreport.txt"

    where bcscript.txt generate a report of the comparison:
    criteria binary
    load "%1" "%2"
    expand all
    folder-report layout:summary output-to:"%3"

    This output report can be customized (another style you might find useful is xml), and parsed to determine how the folders are different.
    Aaron P Scooter Software

  5. #5
    Join Date
    Apr 2017
    Posts
    14

    Default

    Consider it an official feature request then

    I'm trying to decipher the info you present below. I have looked at the scripting guide but it left me somewhat confused.

    Thanks!



    Quote Originally Posted by Aaron View Post
    Hello,

    Launching with two folder inputs is designed to open and compare the two folders. It isn't part of our automation to return an errorlevel for folder pairs (although, it is for *file* pairs if using /qc).

    For folders, you'll want to use scripting, documented in the Help file -> Using Beyond Compare -> Scripting chapter, or the main Scripting Reference chapter. This is executed with something like:
    bcompare.exe "@c:\bcscript.txt" "C:\GLSource" "r:" "c:\reports\bcreport.txt"

    where bcscript.txt generate a report of the comparison:
    criteria binary
    load "%1" "%2"
    expand all
    folder-report layout:summary output-to:"%3"

    This output report can be customized (another style you might find useful is xml), and parsed to determine how the folders are different.

  6. #6
    Join Date
    Apr 2017
    Posts
    14

    Default

    Ok, I'm getting there but I'm having an issue with my report command. Here is what's in the script:

    criteria binary
    load "%1" "%2"
    expand all
    folder-report layout:summary output-to:"%3" output-options:display-mismatches


    My assumption is that the report would ONLY contain differences, and would otherwise have no line items on it. Which would indicate a successful build.

    But when run everything is fine except when I add the output-options:display-mismatches part I get the following error:

    A fatal error has occurred:

    Unexpected argument(s) "output-options:display-mismatches"

    The script will now exit.

    If I remove that option it runs fine, but it generates a huge report showing the comparisons. Opposite of what I want. I ONLY want to see differences (which would indicate a bad build if any existed).

    What am I missing her?
    Last edited by BCLarry; 27-Apr-2017 at 12:48 PM.

  7. #7
    Join Date
    Apr 2017
    Posts
    14

    Default

    After looking at some other examples I re-structured the script as follows:

    criteria binary
    load "%1" "%2"
    expand all
    folder-report layout:summary & options:display-mismatches & output-to:"%3"

    Now I get a different error. Here's the log:



    4/27/2017 3:00:42 PM >> criteria binary
    4/27/2017 3:00:42 PM >> load "C:\testf1" "c:\testf2"
    4/27/2017 3:00:42 PM Load comparison: C:\TestF1 <-> C:\TestF2
    4/27/2017 3:00:42 PM >> expand all
    4/27/2017 3:00:57 PM >> folder-report layout:summary & options:display-mismatches & output-to:"c:\reports\bcreport.txt"
    4/27/2017 3:00:57 PM Fatal Scripting Error: Unexpected argument(s) "&"
    4/27/2017 3:00:59 PM Script completed in 17 seconds

  8. #8
    Join Date
    Apr 2017
    Posts
    14

    Default

    Ok, I got it !

    criteria binary
    load "%1" "%2"
    expand all
    folder-report layout:summary options:display-mismatches output-to:"%3"

    Not sure I understand why all the examples have "&" between the commands...

    I'm closer than ever to my solution

  9. #9
    Join Date
    Apr 2017
    Posts
    14

    Default

    Ok, I think I'm finished (LOL). I have one last hanging question...

    If a batch/script set outputs a report several times to the same file name, does it APPEND to the file, or does it over-write it?

    I hope the answer is append, but I fear it's not. With that in mind, here is my final code (I think). If it turns out it does append, I'll have a change to make (for the better).

    Batch File: keycheck.bat

    c:\keyman\bcport\bcompare.exe "@c:\keyman\bcport\bscript.txt" "C:\GLSource" "E" "c:\reports\Drive E QC Check.txt"
    c:\keyman\bcport\bcompare.exe "@c:\keyman\bcport\bscript.txt" "C:\GLSource" "F" "c:\reports\Drive F QC Check.txt"
    c:\keyman\bcport\bcompare.exe "@c:\keyman\bcport\bscript.txt" "C:\GLSource" "G" "c:\reports\Drive G QC Check.txt"
    c:\keyman\bcport\bcompare.exe "@c:\keyman\bcport\bscript.txt" "C:\GLSource" "H" "c:\reports\Drive H QC Check.txt"
    c:\keyman\bcport\bcompare.exe "@c:\keyman\bcport\bscript.txt" "C:\GLSource" "I" "c:\reports\Drive I QC Check.txt"
    c:\keyman\bcport\bcompare.exe "@c:\keyman\bcport\bscript.txt" "C:\GLSource" "J" "c:\reports\Drive J QC Check.txt"
    c:\keyman\bcport\bcompare.exe "@c:\keyman\bcport\bscript.txt" "C:\GLSource" "K" "c:\reports\Drive K QC Check.txt"
    c:\keyman\bcport\bcompare.exe "@c:\keyman\bcport\bscript.txt" "C:\GLSource" "L" "c:\reports\Drive L QC Check.txt"

    Script File

    criteria binary
    load "%1" "%2"
    expand all
    folder-report layout:summary options:display-mismatches output-to:Printer

    It will be invoked by calling "keycheck.bat" from my main loop batch file.

    I realize the report names in the batch file are redundant since, as written, I'm outputting to the printer but I'm leaving it there in case I change my mind.
    Last edited by BCLarry; 27-Apr-2017 at 01:42 PM.

  10. #10
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,918

    Default

    Hello,

    No, our script won't append, but you could insert an append command in your .bat script:
    type c:\reports\temp.txt >> c:\reports\totalreport.txt

    where the script outputs to temp.txt each time, then appends before calling to the next script. The script itself should output to a file, not the printer.

    However, parsing a full appended report might be more difficult than parsing them individually? You may want to do the parsing in between each step to determine if that specific comparison had any differences.
    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
  •