I think I'm missing something simple. I need to append text to each line of output from a Get-ChildItem instruction.
As a simplistic example, picture adding a reference number ('12345') to a folder listing on c:
The output I'm after would look something vaguely like:
c:\Program Files 12345
c:\program Files (x86) 12345
c:\temp 12345
c:\Users 12345
c:\Windows 12345
...etc
The real application has more to it, but the end result is that a Powershell script runs a bunch of these commands with some metadata appended to each line which then gets pulled into Excel for reporting.
I just can't figure how to add the string to each line...
gci c:\ -Directory -Recurse | select fullname, {'12345'}
gci c:\ -Directory -Recurse | select {"$($_.fullname) 12345"}
1..10 | %{ ("ABC $_") }
. If you plan to generate a CSV you should use a proper way.