Get Extended Properties of a file

8,369

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

Share:
8,369

Related videos on Youtube

HtS
Author by

HtS

Updated on September 18, 2022

Comments

  • HtS
    HtS over 1 year

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

  • Dave
    Dave over 10 years
    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
  • MattV
    MattV over 4 years
    Unfortunately the link doesn't work anymore
  • WireGuy
    WireGuy over 4 years
    @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.