batch files

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pswann
    Visitor
    • Oct 2015
    • 7

    batch files

    I have a batch file similar to below which will not proceed to session two until session 1 is closed. I have 30 different sessions.
    bcompare.exe "session1"
    bcompare.exe "session2"
    bcompare.exe "session3"


    What I would like is to run through the sessions and echo the compare results to a html file or text file that can be viewed so I only have to address the servers that are not the same. If that is not possible, can you suggest a way to open all 30 sessions via script. Any assistance would be appreciated.
  • Aaron
    Team Scooter
    • Oct 2007
    • 16002

    #2
    Hello,

    The above command line would launch the graphical interface, which does not support automation of report creation. Instead, I would recommend using scripting, which is documented in our Help file -> Using Beyond Compare -> Scripting. A sample script might look like this:
    run.bat:
    bcompare.exe "@c:\bcscript.txt" "session1" "c:\bcreportsession1.html"
    bcompare.exe "@c:\bcscript.txt" "session2" "c:\bcreportsession2.html"
    bcompare.exe "@c:\bcscript.txt" "session3" "c:\bcreportsession3.html"

    where bcscript is:
    load "%1"
    expand all
    folder-report layout:side-by-side options:display-mismatches output-to:"%2" output-options:html-color
    Aaron P Scooter Software

    Comment

    • pswann
      Visitor
      • Oct 2015
      • 7

      #3
      Originally posted by Aaron
      Hello,

      The above command line would launch the graphical interface, which does not support automation of report creation. Instead, I would recommend using scripting, which is documented in our Help file -> Using Beyond Compare -> Scripting. A sample script might look like this:
      run.bat:
      bcompare.exe "@c:\bcscript.txt" "session1" "c:\bcreportsession1.html"
      bcompare.exe "@c:\bcscript.txt" "session2" "c:\bcreportsession2.html"
      bcompare.exe "@c:\bcscript.txt" "session3" "c:\bcreportsession3.html"

      where bcscript is:
      load "%1"
      expand all
      folder-report layout:side-by-side options:display-mismatches output-to:"%2" output-options:html-color
      Looks like I posted my issue under the wrong version. I am using 2 and it doesn't like the folder-report layout. Im getting script error:unknown command "folder-report" Is there similar for version 2? Thanks

      Comment

      • Aaron
        Team Scooter
        • Oct 2007
        • 16002

        #4
        BC2's Help file -> Command line and Scripting section, Scripting Reference would let you know the exact syntax you can use.

        folder-report is a BC2 command. Are you using the latest release of BC2 (2.5.3)? All 2.x updates are free for 2.x users:
        http://www.scootersoftware.com/download.php?zz=dl2_en

        If you are still having trouble, can you post your script.txt file as an attachment or email us at [email protected] with it along with a link back to this forum thread.
        Aaron P Scooter Software

        Comment

        • pswann
          Visitor
          • Oct 2015
          • 7

          #5
          The version upgrade fixed it thanks! This is going to be a much better solution

          Comment

          • pswann
            Visitor
            • Oct 2015
            • 7

            #6
            I seem to have the scripts right, and calling all 33 sessions, producing 33 html files. One problem I am still having is if one of the sessions fail the script cannot keep going. Do you have a work around switch for a session that fails on the connect?

            Also is there a way to port the results to a single txt file or a single html file?

            Thanks!

            Comment

            • Aaron
              Team Scooter
              • Oct 2007
              • 16002

              #7
              Hello,

              You would need a bat wrapper that calls BCompare 33 times. That way, if one script has a fatal error, then it continues to the next call, which recalls the script with the next/new parameter and continues. My example above would work for 3 calls, but you would need to expand it to have it call 30 more times.

              We do not append within BC scripting, but the bat file could then do this with the append command:
              type bcreportsession1.html > CombinedReport.html
              type bcreportsession2.html >> CombinedReport.html
              type bcreportsession3.html >> CombinedReport.html
              Aaron P Scooter Software

              Comment

              • pswann
                Visitor
                • Oct 2015
                • 7

                #8
                That is perfect! End result is exactly what I was looking for. And it looks GREAT! Thanks for your help with this.

                Comment

                • pswann
                  Visitor
                  • Oct 2015
                  • 7

                  #9
                  [QUOTE=Aaron;50295]Hello,

                  You would need a bat wrapper that calls BCompare 33 times. That way, if one script has a fatal error, then it continues to the next call, which recalls the script with the next/new parameter and continues. My example above would work for 3 calls, but you would need to expand it to have it call 30 more times.


                  Can you include your example for the statement above. Thanks

                  Comment

                  • Aaron
                    Team Scooter
                    • Oct 2007
                    • 16002

                    #10
                    Hello,

                    The original example covers this scenario. One bat file with multiple calls, run.bat:
                    bcompare.exe "@c:\bcscript.txt" "session1" "c:\bcreportsession1.html"
                    bcompare.exe "@c:\bcscript.txt" "session2" "c:\bcreportsession2.html"
                    bcompare.exe "@c:\bcscript.txt" "session3" "c:\bcreportsession3.html"

                    Each of these is an individual call. If the "session2" call fails for session2 because it does not exist, that one will fail out, and the bat will continue to the next line, calling for session3.
                    Aaron P Scooter Software

                    Comment

                    • pswann
                      Visitor
                      • Oct 2015
                      • 7

                      #11
                      Then that means I am good to go. I enabled logging and see that is the case, it steps right over the problem. Thanks again for your assistance.

                      Comment

                      Working...