【问题标题】:get the version of an installed file获取已安装文件的版本
【发布时间】:2013-06-21 18:25:19
【问题描述】:

我想在部分描述中显示在安装过程中安装的可执行文件的版本?

LangString DESC_SecSoftware ${LANG_ENGLISH} "Software PX"
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${DescText} "Software test"       
!insertmacro MUI_FUNCTION_DESCRIPTION_END

如何读取test.exe的文件版本?

可以像这样读取文件版本:

${GetFileVersion} "C:\ftp\programm.exe" $ProgramVersion

!include "FileFunc.nsh"

但路径必须是绝对的。我无法读取安装中包含的文件版本。

【问题讨论】:

    标签: version nsis


    【解决方案1】:

    ${GetFileVersion} 宏将允许您在执行安装的计算机上在运行时读取文件版本,并且该文件肯定不存在于安装程序 .exe 之外

    相反,您可以使用在编译时执行的GetDllVersionLocal,它将从程序员主机上的原始.exe 中获取版本。

    !include "logiclib.nsh"
    ShowInstDetails show
    OutFile "exeversion.exe"
    
    !define exe_to_read "some.exe"
    
    Section
    
        DetailPrint "getting version $EXEPATH"
        GetDllVersionLocal "${exe_to_read}" $R0 $R1 ;the two values were read during compilation
    
        IntOp $R2 $R0 / 0x00010000
        IntOp $R3 $R0 & 0x0000FFFF
        IntOp $R4 $R1 / 0x00010000
        IntOp $R5 $R1 & 0x0000FFFF
        StrCpy $0 "$R2.$R3.$R4.$R5"
        DetailPrint "version read: $0"
    
    SectionEnd
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-21
      • 1970-01-01
      • 2019-05-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多