• win32api 获取文件版本信息


    #coding:utf-8
    
    myPath="C:\ime"
    
    
    import os
    
    from win32api import GetFileVersionInfo, LOWORD, HIWORD
    
    def get_version_number (filename):
        try:
        	info = GetFileVersionInfo (filename, "\")
        	ms = info['FileVersionMS']
        	ls = info['FileVersionLS']
        	return HIWORD (ms), LOWORD (ms), HIWORD (ls), LOWORD (ls)
        except:
        	return 0,0,0,0
        
    for root, dirs, files in os.walk(myPath):
        for file in files:
        	file = file.lower() # Convert .EXE to .exe so next line works
        	if (file.count('.exe') or file.count('.dll')): # Check only exe or dll files
        		fullPathToFile=os.path.join(root,file)
        		major,minor,subminor,revision=get_version_number(fullPathToFile)
    		fstr = "%s.%s.%s.%s"%(major,minor,subminor,revision)
        		print "Filename: %s 	 Version: %s.%s.%s.%s" % (file,major,minor,subminor,revision)
    

      

  • 相关阅读:
    B2. Cat Party (Hard Edition)
    Dubbo集群容错
    Dubbo负载均衡
    Dubbo多协议支持
    Dubbo服务分组
    Dubbo多版本控制
    Dubbo管控平台
    Dubbo应用到web工程
    Dubbo使用Zookeeper注册中心
    Dubbo直连方式
  • 原文地址:https://www.cnblogs.com/xiaobaichuangtianxia/p/5473866.html
Copyright © 2020-2023  润新知