What's the fastest way to output the 'Title' property of all files in a directory in Windows 7? I tried dir in command line but that only prints the filename, not the Title found in the extended properties. Is there a fast way of iterating a directory (preferably via commandline or batch)?
1 Answer
Check out this link where James O'Neill creates a powershell script to get at any of the extended properties. He uses it to get at all the camera properties stored in a file, but Title is one of them.
Borrowing from Windows Explorer in PowerShell part 2: extended properties
The function:
function Get-ext
{param ($attributes, $Path=(pwd).path) $objShell = New-Object -ComObject Shell.Application $objFolder = $objShell.namespace($path) 0..266 | Foreach-object -begin {$Columns=@{} } -process {$Columns.add($objFolder.getDetailsOf($Null, $_),$_)} foreach ($file in $objFolder.items()) { $attributes | forEach -begin {$fileObj = New-Object -TypeName System.Object } ` -process {Add-Member -inputObject $fileObj -MemberType NoteProperty -Name $_ ` -Value ($objFolder.GetDetailsOf($file , $Columns[$_]) )} ` -end { $fileObj} }
}Calling the function:
Get-ext "name","Title","Tags","f-stop","Exposure Time","ISO Speed" | ft *original url link left in for completeness
3