Python method to get the version Numbers of DLL and EXE files
- 2020-04-02 14:37:29
- OfStack
This article illustrates how Python gets the version Numbers of DLL and EXE files. Share with you for your reference. The specific implementation method is as follows:
import win32api
def getFileVersion(file_name):
info = win32api.GetFileVersionInfo(file_name, os.sep)
ms = info['FileVersionMS']
ls = info['FileVersionLS']
version = '%d.%d.%d.%04d' % (win32api.HIWORD(ms), win32api.LOWORD(ms), win32api.HIWORD(ls), win32api.LOWORD(ls))
return version
I hope this article has helped you with your Python programming.