Use child-item result object in array

会有一股神秘感。 提交于 2019-12-02 04:09:45

You're still using PowerShell v2 or earlier. These early versions don't support member enumeration on arrays, which would allow you to access properties of array elements via the array object itself. Instead you get an empty result, because the array object does not have a property DirectoryName or FullName.

If you can't upgrade to at least PowerShell v3 you can work around this issue with a loop:

$file | ForEach-Object { $_.FullName }

or by expanding the property:

$file | Select-Object -Expand FullName
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!