When running the following Powershell snippet, I get the error Get-Item : Cannot find path 'path' because it does not exist. even though the path in question does exist. As far as I can tell, it only seems to fail when there are two Get-ChildItem
piped together.
Get-ChildItem | Get-ChildItem | % { Get-Item $_ }
The following three snippets do work however.
Get-ChildItem | Get-ChildItem | Get-Item
Get-ChildItem | Get-ChildItem | Get-Item | % { Get-Item $_}
Get-ChildItem | Get-ChildItem | % { Get-Item $_.FullName }
Both Get-ChildItem
and Get-Item
return seem to be returning the same object. What is going on here? What am I missing?