Python获取exe文件版本
import time, datetime, re, subprocess, sys, os, win32net, win32api, win32con, win32netcon, win32security, pymysql, time, \
wmi, requests, ctypes, json
import schedule, shutil, datetime, time
import winreg, math
from glob import glob
import subprocess as sp
import traceback, re
def getFileVersion(file_name):
try:
info = win32api.GetFileVersionInfo(file_name, os.sep)
ms = info['FileVersionMS']
ls = info['FileVersionLS']
version = '%d.%d.%d.%d' % (win32api.HIWORD(ms), win32api.LOWORD(ms), win32api.HIWORD(ls), win32api.LOWORD(ls))
return version
except Exception as e:
return "None"
softwareVersion = getFileVersion("D:\Program Files (x86)\JD\dd_workbench\dd_workbench.exe")
print(softwareVersion)
技术改变一切