How can I auto load a comparison from batch file?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NCTerp
    Visitor
    • Apr 2010
    • 6

    How can I auto load a comparison from batch file?

    I have a workspace that has folder comparisons on three tabs. The folders for all these tabs have dates in their name. Currently, I load the workspace, then change the date of the one of both of the two folders in each tab to look at the current day's comparison.

    Can I script this from a batch file that would pass the names? I don't want a printed report. I want the batch file to load Beyond Compare and present the comparison.
  • Aaron
    Team Scooter
    • Oct 2007
    • 16002

    #2
    Hello,

    You can simply call Bcompare.exe "workspaceName" from the command line or bat file to load the graphical comparison with the workspace loaded.

    If you need to script the renaming, you will need to write a script file to perform the renaming automatically using bcompare.exe @"script.txt" then on the next line of the bat file load bcompare "workspaceName" to load the workspace to verify. If this is what you are looking for, what steps or information would you need to know which folder to rename without manual intervention?
    Aaron P Scooter Software

    Comment

    • NCTerp
      Visitor
      • Apr 2010
      • 6

      #3
      My workspace is named DailyCheck. I have three tabs on the workspace. Tab 1 compare c:\std\04.27.2010 to c:\std\04.28.2010. Tab 2 compares c:\pro\04.27.2010 to c:\pro\04.28.2010. Tab 3 compares c:\tst\04.27.2010 to c:\tst\04.27.2010.

      My goal is to create a batch file that can pass two dates, 04.27.2010 and 04.28.2010 at the command line, and have it fire up Beyond Compare with the proper dates for comparison.

      Maybe I don't need the workspace at all? I'm trying to learn scripting and start by taking a daily task that is a small hassle and see what I can come up with.

      Thanks.

      Comment

      • Aaron
        Team Scooter
        • Oct 2007
        • 16002

        #4
        For a graphical comparison, you could just have a bat file:
        mybat.bat 04.27.2010 04.28.2010

        Then use:
        bcompare.exe c:\std\%1 c:\std\%2
        bcompare.exe c:\pro\%1 c:\pro\%2
        bcompare.exe c:\tst\%1 c:\tst\%2

        How does that work for you?
        Aaron P Scooter Software

        Comment

        • NCTerp
          Visitor
          • Apr 2010
          • 6

          #5
          That seems to be what I needed.

          Strange, but I have found that if Beyond Compare is already open, then the batch file seems to read all the lines and open new tabs for each comparison, which I like.

          If Beyond Compare is not already open when I launch the script, then one line is read and the comparison is done. i then need to close BC so it can launch the next comparison.

          Comment

          • Zoë
            Team Scooter
            • Oct 2007
            • 2666

            #6
            You can use "start bcompare.exe <file1> <file2>" to launch BC and continue with the next line in the batch file without waiting for the previous comparison to complete.
            Zoë P Scooter Software

            Comment

            • hnewman
              New User
              • Apr 2017
              • 2

              #7
              Originally posted by Zoë
              You can use "start bcompare.exe <file1> <file2>" to launch BC and continue with the next line in the batch file without waiting for the previous comparison to complete.
              I'm having the same issue. I tried this, but get strange results. If I don't include the file specs, it launches a CMD box and BC never opens. If I specify the folders, it opens Explorer to the first one on the list, and again, BC never opens. If I leave out the Start, I get the behavior described by the first poster - have to close BC to get the next line to run.

              Comment

              • Aaron
                Team Scooter
                • Oct 2007
                • 16002

                #8
                Hello,

                Could you include your .bat file script? And which version of Beyond Compare are you running (Help menu -> About)?
                Aaron P Scooter Software

                Comment

                • hnewman
                  New User
                  • Apr 2017
                  • 2

                  #9
                  Originally posted by Aaron
                  Hello,

                  Could you include your .bat file script? And which version of Beyond Compare are you running (Help menu -> About)?
                  I'm running v4 build 18847. I'll try updating to 4.1.9 and see if that helps.

                  I've tried both of these in my batch file:

                  "%bcpath%\Beyond Compare 4"bcompare.exe" %sourcepath%\UAT_32 %sourcepath%\PROD_32
                  "%bcpath%\Beyond Compare 4\bcompare.exe" %sourcepath%\UAT_64 %sourcepath%\PROD_64

                  Result: BC opens with the first compare, but I have to close it before the batch file will continue and open the second compare.

                  start "%bcpath%\Beyond Compare 4"bcompare.exe" %sourcepath%\UAT_32 %sourcepath%\PROD_32
                  start "%bcpath%\Beyond Compare 4\bcompare.exe" %sourcepath%\UAT_64 %sourcepath%\PROD_64

                  In this case, a Windows Explorer window opens to the first path in the command line.

                  Comment

                  • Aaron
                    Team Scooter
                    • Oct 2007
                    • 16002

                    #10
                    Hello,

                    Yes, please update to the latest minor release (all 4.x updates are free), as 18847 is the initial 4.0.0 release and we've had many bug fixes.

                    For troubleshooting, please remove all of the %variables% from your .bat script. Using literal paths will help limit any issues a bad variable might be introducing. You can then re-introduce the variables one at a time after the literal paths are working.
                    Aaron P Scooter Software

                    Comment

                    Working...