如何在Inno Setup Pascal脚本中解析安装程序的命令行开关值? [英] How can I resolve installer command-line switch value in Inno Setup Pascal Script?
问题描述
我试图在安装成功时从安装程序中触发S2S像素.该像素需要一些详细信息,例如IP,位置,时间和子ID.
I am trying to fire a S2S pixel from the installer when an install is successful. The pixel require some details like the IP, location, time and sub-id.
执行安装程序时,我获得了除子ID(在命令行中使用/subID=xxxx
开关指定的子ID)之外的所有详细信息.
I got all the details except the sub id, which is specified on the command line using /subID=xxxx
switch, when executing the installer.
推荐答案
您可以使用 {param:ParamName}
伪常量.
You can use the {param:ParamName}
pseudo-constant.
另请参见是否可以使用Inno Setup接受自定义命令行参数.
在Pascal脚本中,您可以使用 ExpandConstant
函数:
In a Pascal Script you can resolve it using the ExpandConstant
function:
ExpandConstant('{param:subID}')
如果需要一些自定义解析,则必须使用 ParamStr
和 ParamCount
函数.
If you need some custom parsing, you will have to parse the command-line explicitly by iterating the parameter list using the ParamStr
and ParamCount
function.
查看上面链接的问题中的一些答案,并且:
See some of the answers in the question linked above, and also:
- Passing a string value to Inno Setup from command line app
- Install files if command-line switch is passed to Inno Setup based installer
这篇关于如何在Inno Setup Pascal脚本中解析安装程序的命令行开关值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!