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 Files\Google\Chrome\Application\chrome.exe" print get_version_via_com(path)