I\'ve compared two files using the following code:
Compare-Object $(Get-Content c:\\user\\documents\\List1.txt) $(Get-Content c:\\user\\documents\\List2.txt)
Another way this could be accomplished is by using the Start-Transcript
and Stop-Transcript
commands, respectively before and after command execution. This would capture the entire session including commands.
Start-Transcript
Stop-Transcript
For this particular case Out-File
is probably your best bet though.