Reputation: 16603
I have a script that's supposed to create some folders if they don't already exist.
"a","b","c" `
| select @{Name="path"; Expression={Join-Path "C:\temp" $_}} `
| select -ExpandProperty path `
| where { -Not (Test-Path $_)}
Is it possible to extract the string from Join-Path more elegantly that assigning it to a named property path
in the new object and then using another select with -ExpandProperty?
Upvotes: 0
Views: 131
Reputation: 9991
Why not simply:
"a","b","c" | %{
Join-Path "C:\temp" $_ } | where { -not (Test-Path $_)}
Upvotes: 2