How to redirect the output of a PowerShell to a file during its execution
Maybe Start-Transcript would work for you. First stop it if it’s already running, then start it, and stop it when done. $ErrorActionPreference=”SilentlyContinue” Stop-Transcript | out-null $ErrorActionPreference = “Continue” Start-Transcript -path C:\output.txt -append # Do some stuff Stop-Transcript You can also have this running while working on stuff and have it saving your command line sessions … Read more