在Inno Setup的Setup部分中使用GetStringFileInfo

时间:2018-03-19 10:53:21

标签: inno-setup

在引用GetStringFileInfo post后,我尝试阅读大会信息并将AppNameFileVersion应用于Inno安装脚本,如下所示。

但编译安装向导只显示"GetStringFileInfo("{#RootDirectory}Sample.exe","Title")"作为软件标题。 GetStringFileInfo根本没有处理。如何让它正确运行?

#define RootDirectory "bin\Release\"

[Setup]
AppName=GetStringFileInfo("{#RootDirectory}Sample.exe","Title")
AppVersion=GetStringFileInfo("{#RootDirectory}Sample.exe","FileVersion")

请注意,我使用的是Script Studio,该文件位于由Inno Setup向导创建的setup.iss中。

2 个答案:

答案 0 :(得分:2)

这是一种基于Inno Setup提供的example的替代方法。他们的代码显示:

#define AppVersion GetFileVersion(AddBackslash(SourcePath) + "MyProg.exe")

[Setup]
AppVersion={#AppVersion}
VersionInfoVersion={#AppVersion}

我已经删除了其他示例。请注意,对GetFileVersion的调用是在[Setup]部分之外完成的。另一个答案有更直接的方式在[Setup]部分内完成。

答案 1 :(得分:1)

GetStringFileInfo是一个预处理函数。 inline call of a preprocessor function的语法是:

AppName={#GetStringFileInfo(RootDirectory + "Sample.exe", "Title")}