Created
May 7, 2020 06:26
-
-
Save shiguruikai/1a2642d4f2d1011723fbef5f4dab438c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function diffc( | |
[Parameter(Mandatory)] | |
[string] | |
$FileA, | |
[Parameter(Mandatory)] | |
[string] | |
$FileB | |
) { | |
Write-Host "--- $(Convert-Path $FileA)" | |
Write-Host "+++ $(Convert-Path $FileB)" | |
Write-Host | |
Compare-Object (Get-Content $FileA) (Get-Content $FileB) | | |
ForEach-Object { | |
$line = "" | |
$foreColor = "" | |
if ($_.SideIndicator -eq "=>") { | |
$line = "+ " + $_.InputObject | |
$foreColor = "Green" | |
} | |
elseif ($_.SideIndicator -eq "<=") { | |
$line = "- " + $_.InputObject | |
$foreColor = "Red" | |
} | |
Write-Host $line -ForegroundColor $foreColor | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment