[Tutor] RE: [python-win32] Executable file version in windows

Christian Wyglendowski Christian.Wyglendowski at greenville.edu
Thu Feb 5 13:05:56 EST 2004


> -----Original Message-----
> How can I query a file executable (exe, dll, com)for its version 
> including the revision, i.e.
> 
> exemple:
>  >>>queryVersion("someprog.exe")
> 5.1.2

Here is another way:

>>> from win32com.client import Dispatch
>>> fso = Dispatch('Scripting.FileSystemObject')
>>> fso.GetFileVersion(r'c:\windows\system32\cacls.exe')
u'5.1.2600.0'
>>> fso.GetFileVersion(r'c:\windows\system32\ntdll.dll')
u'5.1.2600.1217'

> Many thanks

You're welcome!

Christian
http://www.dowski.com



More information about the Tutor mailing list