Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Feb 2017
    Posts
    6

    Default Excel Datacompare via PowerShell in silent mode

    Hello,

    I'm struggling to invoke BCompare.exe via the command line to compare 2 excel files, without the GUI being displayed.

    The command I am using is as follows. I have tried it with the BComp.com, but again that is displaying a GUI. If we use the /qc option instead of the /fv option then we do not get the GUI. However, we find that executing the script when logged in on the machine gives different results than when invoking the very same script via Invoke-Command. Any suggestions

    $ps = new-object System.Diagnostics.Process
    $ps.StartInfo.Filename = "C:\Program Files (x86)\Beyond Compare 3\BCompare.exe"
    $ps.StartInfo.Arguments = "/silent /fv=""Data Compare"" ""$filePathA"" ""$filePathB"""
    $ps.start() |out-null
    $ps.WaitForExit()

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

    Default

    Hello,

    To avoid the GUI, you would need to use either /quickcompare or @script.txt. /quickcompare will generate a return code based on the file input. @script.txt will run the attached @script.txt file and execute the commands within (in this case, probably to generate a text-report would be what you need).

    /quickcompare or /qc would use the default compare method and default settings of the current Windows user account running the command. When testing the graphical interface and your integrated solution, please double check that the same Windows User (%AppData%) is in use. Another strategy is to create a Portable Install to C:\Tools\Beyond Compare 4\ and use this instead. Any user running this install will all share settings, and may be an easier solution for you to troubleshoot a difference in comparison results.


    @script.txt is similarly using the default comparison method, but returns a little more info than just an errorcode. You can run:
    bcompare.exe "@c:\scripts\script.txt" "c:\file1.txt" "c:\file2.txt" "c:\scripts\reportoutput.html"

    where script.txt is:
    text-report layout:side-by-side output-to:"%3" "%1" "%2" output-options:html-color

    Please note that you would pick either /qc or @script, and not both, depending on your automated needs.
    Aaron P Scooter Software

  3. #3
    Join Date
    Feb 2017
    Posts
    6

    Default

    Aaron, executing this on BC3 gives the following exception??

    C:\Windows\system32>"C:\Program Files (x86)\Beyond Compare 3\BCompare.exe" "@c:\
    tmp\bscript.txt" "c:\tmp\Ken.xls" "c:\tmp\Ryu.xls" "c:\tmp\Report.html"

    13/02/2017 16:20:31 Fatal Scripting Error: Unexpected argument(s) "c:\tmp\Ken.xls"

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

    Default

    Hello,

    And could you include the full text of your bcscript.txt? A small typo, whitespace, or syntax error could result in errors.
    Aaron P Scooter Software

  5. #5
    Join Date
    Feb 2017
    Posts
    6

    Default

    This is the contents

    text-report layout:side-by-side output-to:"%3" "%1" "%2" output-options:html-color

    I have also now created a Portable install to ensure we are not dealing with Profiles and am still getting the same issue when being invoked via powershell Invoke-Command

  6. #6
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,947

    Default

    Hello,

    Ah, thanks. I missed the order in my example. It should be:
    text-report layout:side-by-side output-to:"%3" output-options:html-color "%1" "%2"

    with the file name input parameters always trailing the very end.
    Aaron P Scooter Software

  7. #7
    Join Date
    Feb 2017
    Posts
    6

    Default

    Aaron,

    Thanks for that, thats has fixed the issue. However, its still looks like its doing a text compare, when I look at the output in the html file.

    I then started to change the content of bscript.txt to the following, however I receive a 107 script error. Can you see anything wrong with the below. I need to ensure that the xls files are compared using a data compare

    data-report layout:summary options:ignore-unimportant title:"Data Report" output-to:"%3" output-options:html-color "%1" "%2"

    Execution
    "C:\Beyond Compare 3\BCompare.exe" "@c:\tmp\bscript.txt" "c:\tmp\Ken.xls" "c:\tmp\Ryu.xls" "c:\tmp\Report.html"

    Thanks

    Paul

  8. #8
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,947

    Default

    Hello,

    That script looks ok. If you run it from the Windows Command Line (without /silent), what does the script dialog show when it pops up the Script window/log pane?
    Aaron P Scooter Software

  9. #9
    Join Date
    Feb 2017
    Posts
    6

    Default

    Hello,

    On the box itself it seems to run fine, I seem to be experiencing the issue when running remotely then I receive the 107 script error. I'll investigate further to see what it may be.

    Thanks for your help so far.

    Paul

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

    Default

    Hello,

    Is the Beyond Compare install remote, or is it accessing remote locations as a local install?

    Your current Windows User Account (%AppData%) controls settings and registration by default. Using a Portable Install (which the setup.exe can create in C:\Tools\Beyond Compare 4\) might help if there are access problems running as a different user or running as a remote user running a remote install, or something similar.
    Aaron P Scooter Software

Tags for this Thread

Posting Permissions

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