Powered by GeSHi

Source code for txtcomp.ps1

(view source code of txtcomp.ps1 as plain text)

  1. param( [string]$orgfile, [string]$diffile, [string]$switch )
  2.  
  3. If ( $diffile -eq "" ) {
  4. 	Write-Host
  5. 	Write-Host "TxtComp.ps1,  Version 1.00"
  6. 	Write-Host "Compare 2 text files and display the differences"
  7. 	Write-Host
  8. 	Write-Host "Usage:  .\TXTCOMP.PS1  file1  file2  [ /ALL ]"
  9. 	Write-Host
  10. 	Write-Host "Where:  file1 and file2  are the files to be compared"
  11. 	Write-Host "        /ALL             display all lines, not just the differences"
  12. 	Write-Host
  13. 	Write-Host "Written by Rob van der Woude"
  14. 	Write-Host "http://www.robvanderwoude.com"
  15. 	Write-Host
  16. }
  17. Else {
  18. 	If ( $switch -eq "/ALL" ) {
  19. 		Compare-Object $( Get-Content $orgfile ) $( Get-Content $diffile ) -IncludeEqual
  20. 	}
  21. 	Else {
  22. 		Compare-Object $( Get-Content $orgfile ) $( Get-Content $diffile )
  23. 	}
  24. }
  25.