-stream
With
-stream
,
out-string
returns an
array of strings, each of which corresponds to a line from the input:
PS C:\> (get-process | out-string -stream).GetType().FullName
System.Object[]
out-string -stream
can be used in a
pipeline to «grep» for certain strings in the emitted output of a
cmdLet:
PS C:\Users\Rene> get-alias | out-string -stream | select-string Job
Alias gjb -> Get-Job
Alias rcjb -> Receive-Job
Alias rjb -> Remove-Job
Alias rujb -> Resume-Job
Alias sajb -> Start-Job
Alias spjb -> Stop-Job
Alias sujb -> Suspend-Job
Alias wjb -> Wait-Job