I'd like to Write-Verbose
a lot of data to an out file. Here's how I'm doing it.
Start-Transcript -Path $TargetDir\RunUnitTests.log -Width 1000000
Write-Verbose "five million character lines and stuff"
This works great, except that the output is auto wrapped to the standard width of a console, this makes the log look absolutely terrible.
I found a solution heredead link removed
, but it's so involved and complicated that I don't want to just throw this in my script below a comment #Thar be dragons
.
Is there a better way to do this?
Here is a very simple workaround based on
Write-Host
which does not have such a problem. In the beginning of the session install/dot-source the replacement of the defaultWrite-Verbose
:Then this works as needed:
That is: it takes into account
$VerbosePreference
, it writes to host in yellow, transcript output is not wrapped and it is still marked VERBOSE.