0

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)?

Andrea
  • 1,516
  • 4
  • 17
  • 19
HtS
  • 323
  • 1
  • 4
  • 8
  • Probably can be done using PowerShell in Windows7, but have no clue how to get it done though....http://msdn.microsoft.com/en-us/library/windows/desktop/ms714415(v=vs.85).aspx – Moab Feb 27 '12 at 03:50
  • Sounds similar to a question I had awhile ago. I'll see if I can dig it up. – Iszi Feb 27 '12 at 04:20
  • Here. See if you can adapt some of the answers from this question to help: http://superuser.com/questions/363278/is-there-a-way-to-get-file-metadata-from-the-command-line – Iszi Feb 27 '12 at 04:23

1 Answers1

2

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

http://blogs.technet.com/b/jamesone/archive/2008/12/09/borrowing-from-windows-explorer-in-powershell-part-2-extended-properties.aspx

WireGuy
  • 1,709
  • 2
  • 14
  • 18
  • 2
    You could easily copy the relevant content into your post. The problem with link only answers is links go bad! Copying content is absolutely fine providing it is cited (as it is). If you copy the content over, I'll remove my -1 – Dave Nov 12 '13 at 09:22
  • Unfortunately the link doesn't work anymore – MattV Jan 23 '20 at 09:45
  • @MattV the link was moved to an archive, I have updated the link and kept the original link for reference and searching. And the code is now included. – WireGuy Jan 24 '20 at 12:22