Announcement

Collapse
No announcement yet.

Using Scripting in Powershell

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

  • Using Scripting in Powershell

    Hi Guys,

    I'm pretty new to scripting with Beyond Compare and Power shell (only done about 4 hours of work!) and I've come across an issue.

    I want to be able to run Beyond compare commands directly within power shell. From what I can see, this can only be done via external scripts. Is it not possible to run all my commands directly within Powershell?

    In this case, I'm trying to do a BC on two folders and like to have the result displayed in a nicely formatted HTML page.

    Running this on Powershell works for which it compares in BC:
    & "C:\Program Files\Beyond Compare 4\BCompare.exe" "$folder1" "$folder2"

    But if I then try and view it as HTML, I do the following:
    & "C:\Program Files\Beyond Compare 4\BCompare.exe" "$folder1" "$folder2" "criteria rules-based" "load" "$folder1" "$folder2" "expand all" "select all.files" "folder-report layout:side-by-side options:include-file-links" "output-to:\ output-options:html-color"

    This doesn't work.

    So am I right in assuming, I'll have to generate an external script and link it to my powershell file or is it possible to run these commands within Powershell directly?

    Thank you!

  • #2
    Hello,

    BC4's scripting support loads a specific script file (c:\bcscript.txt) which then contains a series of script commands separated by newlines. It's a specific syntax, and executing script mode requires the "@" parameter in front of the file.

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

    You might be able to create a single line that generates and then calls to this script file, but it would probably be easier to create the script file separately. It can also accept parameter text, such as:

    bcompare.exe "@c:\bcscript.txt" "c:\folder1" "c:\folder2" "c:\reports\bcreport.html"

    where this text can be loaded in bcscript.txt with $1 and $2 etc

    criteria rules-based
    load" "%1" "%2"
    expand all
    folder-report layout:side-by-side options:include-file-links output-to:"%3" output-options:html-color
    Last edited by Aaron; 11-Jul-2018, 04:45 PM. Reason: update $ to %
    Aaron P Scooter Software

    Comment


    • #3
      Thanks Aaron.
      After taking on your changes I had to make one final update to the script you provided by replacing the $ with %

      All is working as expected!

      Comment


      • #4
        Ah, you're right. Whoops! I used the wrong character, and it should indeed be %1, %2, %3, %4, etc, for each parameter.
        Aaron P Scooter Software

        Comment

        Working...
        X