File version on Windows
Matt Gerrans
mgerrans at mindspring.com
Fri May 23 02:09:42 EDT 2003
If you happen to be running on a new HP or Compaq machine, you can easily
get all the available version information in a file from a pre-installed COM
Automation object called WshTools. This is particularly handy if you need
the "Assembly Version" of a .Net assembly which has strong naming.
Here's an example:
>>> from win32com.client import Dispatch
>>> wsh = Dispatch('WshTools.SystemTools')
>>> filename = r'c:\hp\bin\WshTools.dll'
>>> wsh.GetFileVersionInfo( filename, 'FileVersion' )
u'1.1.1.0'
>>> wsh.GetFileVersionInfo( filename, 'ProductVersion' )
u'1.0.0.0'
This GetFileVersionInfo() method was added in version 1.1.1.0 of WshTools,
so if you have an older one, you won't see it. :-(
- Matt
"Eugene C." <hc_74 at yahoo.com> wrote in message
news:qKaza.47148$h42.22203 at twister.nyc.rr.com...
> Hey all. I've been browsing the Python documents and the Internet for
> information on retrieving the version of a file on Windows-based machines.
> It seems there is a Win32API method called GetFileVersionInfo() which
> retrieves the version information from a file. However, the win32api
module
> (from win32all extensions) which comes with ActiveState Python does not
> include this method. Anyone have any ideas how I can get file version
info?
> Thanks much!
>
>
More information about the Python-list
mailing list