从 PyInstaller-pyi-grab_version 生成的可执行文件中提取版本信息

从 PyInstaller-pyi-grab_version 生成的可执行文件中提取版本信息

TanHaX
2023-06-04 / 0 评论 / 327 阅读 / 正在检测是否收录...

1. 要使用pyi-grab_version,您需要先安装PyInstaller。您可以使用pip来安装它。在Windows 终端(cmd)中输入以下命令:

pip install pyinstaller

2. 我们需要在 Windows终端 中进入您要获取版本的程序目录下,执行以下命令操作。

pyi-grab_version yourprogramname.exe

pC9sAW8.png

3.当命令执行完成后,会在目录下生成一个file_version_info.txt名称的文件。

# UTF-8
#
# For more details about fixed file info 'ffi' see:
# http://msdn.microsoft.com/en-us/library/ms646997.aspx
VSVersionInfo(
  ffi=FixedFileInfo(
    # filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
    # Set not needed items to zero 0.
    filevers=(1, 0, 0, 0),
    prodvers=(1, 0, 0, 0),
    # Contains a bitmask that specifies the valid bits 'flags'r
    mask=0x16,
    # Contains a bitmask that specifies the Boolean attributes of the file.
    flags=0x0,
    # The operating system for which this file was designed.
    # 0x4 - NT and there is no need to change it.
    OS=0x40004,
    # The general type of file.
    # 0x1 - the file is an application.
    fileType=0x1,
    # The function of the file.
    # 0x0 - the function is not defined for this fileType
    subtype=0x0,
    # Creation date and time stamp.
    date=(0, 0)
    ),
  kids=[
    StringFileInfo(
      [
      StringTable(
        '080404b0',
        [StringStruct('CompanyName', 'Smilinghan'),
        StringStruct('FileDescription', 'Smilinghan-PC'),
        StringStruct('FileVersion', '1.0.0.0'),
        StringStruct('InternalName', 'Smilinghan-PC.exe'),
        StringStruct('LegalCopyright', 'Copyright (C) 2023-2023 by Smilinghan (nihaotang.com)'),
        StringStruct('OriginalFilename', 'Smilinghan-PC'),
        StringStruct('ProductName', 'Smilinghan-PC'),
        StringStruct('ProductVersion', '1.0.0.0')])
      ]), 
    VarFileInfo([VarStruct('Translation', [2050, 1000])])
  ]
)
1

打赏

评论 (0)

取消