win32 file attributes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • David Bear

    win32 file attributes

    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"
  • Roger Upole

    #2
    Re: win32 file attributes

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

    "David Bear" <david.bear@asu .edu> wrote in message
    news:m3wucxo1te .fsf@moroni.pp. asu.edu...[color=blue]
    > 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"[/color]


    Comment

    • Tim Golden

      #3
      Re: win32 file attributes

      David Bear <david.bear@asu .edu> wrote in message news:<m3wucxo1t e.fsf@moroni.pp .asu.edu>...[color=blue]
      > 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...[/color]

      This isn't the first time this query has come up. Use Google to search
      c.l.py for GetFileVersionI nfo 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.basenam e (f.Name), "is at version", f.Version

      </code>

      TJG

      Comment

      Working...