Reputation: 1707
I want to add a path string to all file names returned by get-childitem from a folder.
I have tried something like
Get-ChildItem C:\path\folder |'different path' + {$}
I want to add a different path to all the file anmes returned from the folder. But it won't compile.
Upvotes: 0
Views: 1319
Reputation: 17462
or this:
Get-ChildItem C:\temp -file | select @{N="Name";E={"different path {0}" -f $_.Name}}
Upvotes: 2
Reputation: 17462
try it:
Get-ChildItem C:\temp -file | %{"different path {0}" -f $_.Name}
Upvotes: 1
Reputation: 21757
You mean something like this?
Get-ChildItem -Name C:\path\folder | foreach {"different path $_"}
Upvotes: 0