Path cmdlets: 5 Resolve-Path
I normally start PowerShell in my c:\scripts directory
gives me the list of .ps1 files in that folder. Some of that information I may not need and it doesn’t give me the full path
PS> Resolve-Path *.ps1
gives me a list of the files that meet the criteria. The important point is the returned property is called path. This means we can do this
Resolve-Path *.ps1 | Copy-Item -Destination c:\test –WhatIf
In otherwords we can pipe straight into a cmdlet that accepts a Path parameter!
Remember that Get-ChildItem doesn’t produce a property called path.
I’ve ignored Resolve-Path up to now but I’m beginning to think of all sorts of uses for it. The one drawback is that it doesn’t recurse through subfolders