Hi
I have the following script off compare-object that is sending the results to outfile process7.txt.
This is working fine.
type or foreach ($File in $FileList) {
$FilePath1 = $File -replace 'Version1', $VersionList[0]
$FilePath2 = $File -replace 'Version1', $VersionList[1]
$FilePath3 = Get-ChildItem -Path $FilePath2
$Content1 = Get-Content -Path $FilePath1
$Content2 = Get-Content -Path $FilePath3
$output = Compare-Object -ReferenceObject $Content1 -DifferenceObject $Content2
write-output "File name is" $File "and it corresponding output is:" $output|Out-File -FilePath .\Process7.txt -Append
}paste code here
But the same script instead off sending to output file i want to write it out to a screen as follows:
foreach ($File in $FileList) {
$FilePath1 = $File -replace 'Version1', $VersionList[0]
$FilePath2 = $File -replace 'Version1', $VersionList[1]
$FilePath3 = Get-ChildItem -Path $FilePath2
$Content1 = Get-Content -Path $FilePath1
$Content2 = Get-Content -Path $FilePath3
$output = Compare-Object -ReferenceObject $Content1 -DifferenceObject $Content2|
if($output.count -ne 0)
{
write-host "Files not equal"
}
else{
Write-host "EQUAL!!"
}
But the script is hosed at the
prompt
Please see attached.
What am i doing wrong?
Again thanks for the help in advance!