I am trying to compare two files, if I manually open them in BC they produce no differences. But when I set up a powershell script to compare them I get the Error 100 code and rule false.
Here is my code:
Import-Module E:\code\DevOps\Dev\ReportComparison\Shared.psm1 -WarningAction silentlyContinue
$directory = '\\report-compare\webshare\Ken\ReportData\ReportComparisonDi fferences'
$latestfile = Get-ChildItem -path $directory | Sort-Object -Property LastWriteTime -Descending | Select-Object -First 1
$latestfile.FullName
$latestfile2 = Get-ChildItem -path $directory | Sort-Object -Property LastWriteTime -Descending | Select-Object -Skip 1 -First 1
$latestfile2.FullName
Compare-FilesBeyondCompare $latestfile $latestfile2
function Compare-FilesBeyondCompare() {
param([Parameter(Mandatory=$true)]$filePathA,[Parameter(Mandatory=$true)]$filePathB)
$ps = new-object System.Diagnostics.Process
$ps.StartInfo.Filename = "C:\Program Files (x86)\Beyond Compare 3\BComp.exe"
$ps.StartInfo.Arguments = "/qc ""$filePathA"" ""$filePathB"""
$ps.start() |out-null
$ps.WaitForExit()
<#
0 Success
1 Binary same
2 Rules-based same
11 Binary differences
12 Similar
13 Rules-based differences
14 Conflicts detected
100 Unknown error
101 Conflicts detected, merge output not written
102 BComp.exe unable to wait until BCompare.exe finishes
103 BComp.exe cannot find BCompare.exe
104 Trial period expired
105 Error loading script file
106 Script syntax error
107 Script failed to load folders or files
#>
$rul = $ps.ExitCode -eq 2
$exitCode = $ps.ExitCode
Write-Host "$filePathA" "$filePathB"
Write-Host "rul=$rul, exitCode=$exitCode"
<#$bin -eq $True -or $rul -eq $True#>
$exitCode -lt 13
}
The second part of code is from a different file powershellmodule which is imported at the top of the first block of code.
I know there aren't any issues with the directorys as i'm using the variable.fullname to output the names of the files which are correct. The issue looks like it is to do with the comparison process itself.
Any ideas?
I'm using BC3
Here is my code:
Import-Module E:\code\DevOps\Dev\ReportComparison\Shared.psm1 -WarningAction silentlyContinue
$directory = '\\report-compare\webshare\Ken\ReportData\ReportComparisonDi fferences'
$latestfile = Get-ChildItem -path $directory | Sort-Object -Property LastWriteTime -Descending | Select-Object -First 1
$latestfile.FullName
$latestfile2 = Get-ChildItem -path $directory | Sort-Object -Property LastWriteTime -Descending | Select-Object -Skip 1 -First 1
$latestfile2.FullName
Compare-FilesBeyondCompare $latestfile $latestfile2
function Compare-FilesBeyondCompare() {
param([Parameter(Mandatory=$true)]$filePathA,[Parameter(Mandatory=$true)]$filePathB)
$ps = new-object System.Diagnostics.Process
$ps.StartInfo.Filename = "C:\Program Files (x86)\Beyond Compare 3\BComp.exe"
$ps.StartInfo.Arguments = "/qc ""$filePathA"" ""$filePathB"""
$ps.start() |out-null
$ps.WaitForExit()
<#
0 Success
1 Binary same
2 Rules-based same
11 Binary differences
12 Similar
13 Rules-based differences
14 Conflicts detected
100 Unknown error
101 Conflicts detected, merge output not written
102 BComp.exe unable to wait until BCompare.exe finishes
103 BComp.exe cannot find BCompare.exe
104 Trial period expired
105 Error loading script file
106 Script syntax error
107 Script failed to load folders or files
#>
$rul = $ps.ExitCode -eq 2
$exitCode = $ps.ExitCode
Write-Host "$filePathA" "$filePathB"
Write-Host "rul=$rul, exitCode=$exitCode"
<#$bin -eq $True -or $rul -eq $True#>
$exitCode -lt 13
}
The second part of code is from a different file powershellmodule which is imported at the top of the first block of code.
I know there aren't any issues with the directorys as i'm using the variable.fullname to output the names of the files which are correct. The issue looks like it is to do with the comparison process itself.
Any ideas?
I'm using BC3
Comment