How to extract metadata using a specific filename (get-childitem) rather than looping through ComObject namespace items
问题 I have found multiple code snippets to scroll through a folder and display the metadata of each item in the folder, like this: function funLine($strIN) { $strLine = "=" * $strIn.length Write-Host -ForegroundColor Yellow "`n$strIN" Write-Host -ForegroundColor Cyan $strLine } $sfolder = "S:\Temp" $objShell = New-Object -ComObject Shell.Application $objFolder = $objShell.namespace($sFolder) foreach ($strFileName in $objFolder.items()) {funline "$($strFileName.name)" for ($a ; $a -le 266; $a++) {