2

I was wondering if it is possible to get the properties of selected files using a batch file. I only found a winbatch example that was able to do this. Any suggestions are welcome. Thanks

3
  • What properties would you like to get? Commented Jun 27, 2011 at 14:43
  • What kind of files (e.g. Word documents or arbitrary files)? Can you post a screenshot of how these properties are accessed via GUI? Commented Jun 27, 2011 at 16:51
  • Word docs is all im trying to get the properties for Commented Jun 27, 2011 at 19:35

2 Answers 2

2

For standard Windows file properties, use WMIC DATAFILE.

Some file formats (for example .mp3 in the ID3 headers) have well known properties. Eventhough some of them might be shown by Explorer, not all of them are available through WMIC DATAFILE.

And finally many other document properties in custom file formats are stored without easy (or even possible at all) external access.

Sign up to request clarification or add additional context in comments.

2 Comments

Could you give an specific example? It doesn't seem to work for the extended properties that franl requested.
More specifically, what he requests doesn't seem to be part of the properties accessible to wmic datafile.
0

Using VBScript, I was able to display the last author and manager from a recent Word 2010 document I created:

Option Explicit

Const Schema_LastAuthor = "{F29F85E0-4FF9-1068-AB91-08002B27B3D9} 8"
Const Schema_Manager = "{D5CDD502-2E9C-101B-9397-08002B2CF9AE} 14"

Dim Shell
Set Shell = CreateObject("Shell.Application")

If (Not Shell Is Nothing) Then

    Dim ThisFolder
    Set ThisFolder = Shell.NameSpace("YOUR_FOLDER_HERE")

    If (Not ThisFolder Is Nothing) Then

        Dim ThisFolderItem
        Set ThisFolderItem = ThisFolder.ParseName("YOUR_DOCUMENT_HERE")

        If (Not ThisFolderItem Is Nothing) Then

            Dim lastAuthor, manager
            lastAuthor = ThisFolderItem.ExtendedProperty(Schema_LastAuthor)
            manager = ThisFolderItem.ExtendedProperty(Schema_Manager)

            WScript.Echo "   Document:   " & ThisFolderItem.Name
            WScript.Echo "Last author:   " & lastAuthor
            WScript.Echo "    Manager:   " & manager

        End If

        Set ThisFolderItem = Nothing

    End If

    Set ThisFolder = Nothing

End If

Set Shell = Nothing

WScript.Quit

Here's more information on the Windows Property System schema for documents. Hope this helps!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.