Branko Čibej <br...@apache.org> writes: > PowerShell fiddles with redirected stdout? That's ... scary! > > Out of interest, do you know what it does with the data in the stream > and why?
It assumes that commands output text, and automatically splits the output based on line endings: $out = svnadmin dump C:\Repositories\test $out.GetType() # Object[] $out.Length # 14 $out[0].GetType() # String $out[0] # SVN-fs-dump-format-version: 2 Redirection is implemented as pipelining the array of strings to the Out-File command. This command reconstitutes the text and translates it based on the current encoding, and that produces unreadable dumps. In case you're interested, there's an in depth explanation available in [1]. I am not too sure about the "why" part, but maybe assuming everything as text has its benefits for the majority of commands and cmdlets. Or perhaps, this is just a side effect of making > work in a predictable way for both PowerShell commands and executables. [1] http://brianreiter.org/2010/01/29/powershells-object-pipeline-corrupts-piped-binary-data Regards, Evgeny Kotkov