Announcement

Collapse
No announcement yet.

Multiple Compares at once ?

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

  • 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
    Did you try typing EXIT as the last line in your batch file?

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

    Comment


    • #3
      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.

      Comment


      • #4
        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

        Comment


        • #5
          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!



          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.

          Comment


          • #6
            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, 02:48 PM.

            Comment


            • #7
              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

              Comment


              • #8
                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

                Comment


                • #9
                  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, 03:42 PM.

                  Comment


                  • #10
                    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

                    Comment


                    • #11
                      Originally posted by Aaron View Post
                      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.
                      Good idea. I'll give that a shot.

                      I may keep the single printed outputs though. It does give me a QC check document to include in each shipment with the key so when they blow it and format their imaging keys by accident, they can't use the old "you sent me a bad key" horse crap

                      Comment


                      • #12
                        Ok, everything is up, running and working great!

                        My final script did turn out a bit different than your example. Your example was:

                        criteria binary
                        load "%1" "%2"
                        expand all


                        Mine ended up as:


                        load "%1" "%2"
                        expand all
                        compare binary


                        NOTE: Not full script, just hilighting the difference.

                        The problem I was having with the script as provided is the script would run, but it would sit there and never finish. Since there's no open window to see I could not really see where it was hung up, but by removing and moving commands around, I discovered it was the "criteria binary" command.

                        So, after reading through the scripting documents, I removed that and added in the Compare Binary command instead, and removed the criteria binary line.

                        Now things are moving along nicely. I even made some changes to one of the key's on purpose to make sure they were caught, and they were.

                        So... what is the difference between the criteria binary and the compare binary commands, and why was it hanging up on the criteria binary version?

                        The source size is about 40GB btw... It's a full Windows 10 installation boot installer.

                        Comment


                        • #13
                          Hello,

                          The "compare binary" script works on a selection, which you do not have in the above example, so it wouldn't act on any files. You could remove that line. To work with a "compare", add a "select" line below "expand all" and above "compare" to select a subset (or all files), then compare them. Similar to using the interface, selecting some or all files, right clicking and using Compare Contents.

                          If you only need to verify with timestamp/size (default scan type) then you do not need to configure the criteria/compare. If you need a more detailed verification, then you can re-add the criteria binary command at the top, which is a more intensive scan.
                          To test, you can load the graphical interface, Folder Compare, and in the Session Settings enable the Comparison tab's Content Compare: Binary, and you can note how the scan is completing by the folder colors. It would take much longer than a default timestamp/size scan, since it is scanning the entire file (until it finds any difference between the pair).
                          Last edited by Aaron; 28-Apr-2017, 11:26 AM. Reason: Expanded on "compare" description
                          Aaron P Scooter Software

                          Comment


                          • #14
                            Wow, now I'm thoroughly confused.

                            As my script is, if I make a change (in testing) to the destination and run it, it DOES find the change I made. Whether I remove files or add them, it finds them and it's in the report. Is it working maybe because the compare is defaulting to "All" selection since it's not specified? Or is it using a different, more simple criteria for the comparison. It must be doing something because, as written, it DOES find missing or extra files in the right pane (the destination drives).

                            Your first paragraph has me totally confused. Can you show me an example?

                            Thanks

                            EDIT:

                            Is this what you mean?

                            load "%1" "%2"
                            expand all
                            select all
                            compare binary
                            Last edited by BCLarry; 28-Apr-2017, 05:05 PM.

                            Comment


                            • #15
                              Another question.

                              When you load BC, in it's default installation state, and select folder compare and choose a folder for the left, then a folder on the right, it automatically runs a compare and shows the results (in black, grey, purple, etc...)

                              Exactly what kind of compare was actually done there? It is very fast even for 40GB folders such as I have.

                              Comment

                              Working...
                              X