win32 file attributes

D

David Bear

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...

--
David Bear
phone: 480-965-8257
fax: 480-965-9189
College of Public Programs/ASU
Wilson Hall 232
Tempe, AZ 85287-0803
"Beware the IP portfolio, everyone will be suspect of trespassing"
 
R

Roger Upole

The corresponding api call would be GetFileVersionInfo.
As far as I know, nobody has wrapped it for Python yet,
probably because it looks to be fairly painful.
Roger
 
T

Tim Golden

David Bear said:
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
c.l.py 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 (http://tgolden.sc.sabren.com/python/wmi.html)
2) Try this:

<code>

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

</code>

TJG
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,782
Latest member
ThomasGex

Latest Threads

Top