Get version of Windows process using python

327 Views Asked by At

Is there a way to get the "Product version" of a running Windows process as shown in the "Details" tab of its properties using Python?

Thanks a lot for your response.

1

There are 1 best solutions below

4
On

Using pywin32:

>>> import win32api
>>> info = win32api.GetFileVersionInfo(r'c:\windows\system32\cmd.exe', '\\')
>>> '%s.%s.%s.%s' % (
...     info['FileVersionMS'] >> 16,
...     info['FileVersionMS'] & 0xffff,
...     info['FileVersionLS'] >> 16,
...     info['FileVersionLS'] & 0xffff)
'5.1.2600.5512'