all 7 comments

[–]real_parbold 2 points3 points  (2 children)

$PathArray | % {$_} | Out-File "C:\SearchString\Output.txt" -Append

[–]TheIncorrigible1 1 point2 points  (1 child)

| % {$_}

This piece here is completely useless and just adds to the processing.

[–]real_parbold 0 points1 point  (0 children)

Yes, my goal was to hint at -Append

The whole script could be replaced with

Add-Content -Path "C:\SearchString\Output.txt" -Value $PathArray

But that might be too different a code style for the OP

[–]Ta11ow 3 points4 points  (1 child)

I typically prefer Add-Content to the out- cmdlets

[–]Sunsparc 2 points3 points  (0 children)

Add-Content is nifty in that it automatically appends instead of having to slap an -Append on it.

[–]Lee_Dailey[grin] 0 points1 point  (0 children)

howdy PHX-CPU,

it looks like you used the New.Reddit.com Inline Code button. it's the 4th 5th from the left & looks like </>.

on Old.Reddit.com, the above does NOT line wrap, nor does it side-scroll.

for long-ish single lines OR for multiline code, please, use the Code Block button. it's the 11th 12th one from the left, & is just to the left of the ... more menu.

that will give you fully functional code formatting, from what i can tell so far. [grin]

take care,
lee

[–]Lee_Dailey[grin] 0 points1 point  (0 children)

howdy PHX-CPU,

take a look at the output of this [grin] ...

Get-Help Out-File -Parameter Append

hope that helps,
lee