Python 获得程序 exe 的版本号

Python 获得程序 exe 的版本号

python中需要安装 pywin32 包

# based on http://stackoverflow.com/questions/580924/python-windows-file-version-attribute
from win32com.client import Dispatch
 
def get_version_via_com(filename):
    parser = Dispatch("Scripting.FileSystemObject")
    version = parser.GetFileVersion(filename)
    return version
 
if __name__ == "__main__":
    path = r"C:Program FilesGoogleChromeApplicationchrome.exe"
    print get_version_via_com(path)
原文地址:https://www.cnblogs.com/ibingshan/p/10881904.html