win32 file attributes

Tim Golden tim.golden at
Fri Aug 29 10:48:09 CEST 2003

David Bear <david.bear at> wrote in message news:<m3wucxo1te.fsf at>...
> Using the windows explorer it is possible to get file properties which
> include under the version tab, 'company name', 'version', etc.  I'm
> assuming these metadata are actually stored in the exe somewhere.  Is
> there an api exposed to python that would allow me to get this info?
> a scan of Mark Hammonds win32all package did have anything obvious
> jump out at me...

This isn't the first time this query has come up. Use Google to search for GetFileVersionInfo and see if any of those links helps you
out. I seem to remember seeing someone's Python wrapper for this
really recently, but for the life of me I can't put my finger on it
now. FWIW, here's my twopence-ha'penny worth:

1) Get wmi (
2) Try this:


import os
from glob import glob

import wmi

c = wmi.WMI ()
for exe in glob ("c:\\winnt\\*.exe"):
  for f in c.CIM_DataFile (Name=exe):
    print os.path.basename (f.Name), "is at version", f.Version



More information about the Python-list mailing list