Question Regarding Starting BC3 From The Command Line

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tackyjan
    Enthusiast
    • Aug 2012
    • 23

    Question Regarding Starting BC3 From The Command Line

    Hello All,

    I just recently discovered the feature that you can start Beyond Compare from the command line and provide the session name as an argument to BCompare.exe. This starts BC and opens the session and begins the analysis.

    BCompare.exe "My Session 1"

    The question I have is.... is there another command line option (or a way in general) to have the program automatically run an additional command after the compare is finished? For example, I always Mirror Right so I would love to be able to automate the entire thing.

    Something like...

    BCompare.exe "My Session 1" -action="Mirror Right"

    Alternatively, you could provide an option for a session to auto-execute a command(s) when the compare is complete. This information would then be saved in the profile configuration. This would eliminate the need for any additional command line parameters.

    Thanks!

    P.S. We use BC3 extensively at work and everyone loves it and cannot live without it!
    Last edited by tackyjan; 24-Aug-2012, 04:29 PM.
  • Aaron
    Team Scooter
    • Oct 2007
    • 16000

    #2
    Hello,

    Not as a series of two command lines, but this is why Beyond Compare supports BCScripting. BCScripting is run with a single command, like this:

    bcompare.exe "@c:\script.txt"

    Where script.txt can contain a couple of simple script commands (documented in the Help File -> Using Beyond Compare -> Automating with Script; or Scripting Reference) such as:
    log verbose "c:\logs\bclog.txt"
    load "My Session 1"
    sync create-empty mirror:left->right

    Please note that script actions do not preview before they run, and are not undo-able, so please test with test data or test folders first, to make sure the script behaves as you expect before using on your live data.

    There are a few other tricks, too, such as:
    bcompare.exe "c:\bcscript.txt "My session 1"

    with script.txt of:
    load "%1"
    sync create-empty mirror:left->right

    Also documented in the Automating With Script chapter.

    If you have any questions, please let us know.
    Aaron P Scooter Software

    Comment

    • tackyjan
      Enthusiast
      • Aug 2012
      • 23

      #3
      Originally posted by Aaron
      Hello,

      Not as a series of two command lines, but this is why Beyond Compare supports BCScripting. BCScripting is run with a single command, like this:

      bcompare.exe "@c:\script.txt"

      Where script.txt can contain a couple of simple script commands (documented in the Help File -> Using Beyond Compare -> Automating with Script; or Scripting Reference) such as:
      log verbose "c:\logs\bclog.txt"
      load "My Session 1"
      sync create-empty mirror:left->right

      Please note that script actions do not preview before they run, and are not undo-able, so please test with test data or test folders first, to make sure the script behaves as you expect before using on your live data.

      There are a few other tricks, too, such as:
      bcompare.exe "c:\bcscript.txt "My session 1"

      with script.txt of:
      load "%1"
      sync create-empty mirror:left->right

      Also documented in the Automating With Script chapter.

      If you have any questions, please let us know.
      WOWOW I just did this for the first time and I am totally amazed!!!!

      Is there a way to run multiple scripts against multiple sessions at once?

      for example, my batch file has:

      BCompare.exe @script.txt "My Session 1"
      BCompare.exe @script.txt "My Session 2"
      BCompare.exe @script.txt "My Session 3"

      The second one doesn't run until the first one is finished and the first one doesn't finish until I close the status dialog. If possible, I would like to keep the dialog for each session open so I can see the results later on.

      Comment

      • tackyjan
        Enthusiast
        • Aug 2012
        • 23

        #4
        Originally posted by tackyjan
        Is there a way to run multiple scripts against multiple sessions at once?

        for example, my batch file has:

        BCompare.exe @script.txt "My Session 1"
        BCompare.exe @script.txt "My Session 2"
        BCompare.exe @script.txt "My Session 3"

        The second one doesn't run until the first one is finished and the first one doesn't finish until I close the status dialog. If possible, I would like to keep the dialog for each session open so I can see the results later on.
        Lol never mind I answered my own question... just put start in front of each line:

        start BCompare.exe @script.txt "My Sesson 1"
        ...
        ...

        Comment

        • Aaron
          Team Scooter
          • Oct 2007
          • 16000

          #5
          Hello,

          You can also enable an option to automatically close the script window. It is a checkbox in the Script dialog itself, or in the main BC3 Tools menu -> Options, Scripts section.
          Aaron P Scooter Software

          Comment

          Working...