Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: batch files

  1. #1
    Join Date
    Oct 2015
    Posts
    7

    Default 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.

  2. #2
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,788

    Default

    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

  3. #3
    Join Date
    Oct 2015
    Posts
    7

    Default

    Quote Originally Posted by Aaron View Post
    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

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

    Default

    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 support@scootersoftware.com with it along with a link back to this forum thread.
    Aaron P Scooter Software

  5. #5
    Join Date
    Oct 2015
    Posts
    7

    Default

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

  6. #6
    Join Date
    Oct 2015
    Posts
    7

    Default

    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!

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

    Default

    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

  8. #8
    Join Date
    Oct 2015
    Posts
    7

    Default

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

  9. #9
    Join Date
    Oct 2015
    Posts
    7

    Default

    [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

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

    Default

    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

Posting Permissions

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