Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2018
    Posts
    2

    Default 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. #2
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,750

    Default

    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 at 02:45 PM. Reason: update $ to %
    Aaron P Scooter Software

  3. #3
    Join Date
    Jul 2018
    Posts
    2

    Default

    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!

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

    Default

    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

Posting Permissions

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