从命令行应用程序将字符串值传递给Inno Setup [英] Passing a string value to Inno Setup from command line app

查看:66
本文介绍了从命令行应用程序将字符串值传递给Inno Setup的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这种情况是,我们有一个客户端/服务器应用程序,其中客户端安装是使用Inno Setup的引导程序,该安装程序从IP/端口号指定的服务器上下载了客户端.我们希望能够通过UDP广播检测本地网络上是否有服务器,并可以编写一个控制台应用程序来执行此操作.问题是,我们如何将信息从控制台应用程序传递到安装程序?

The scenario is that we have a client/server app with the client install being a bootstrapper using Inno Setup that downloads the client from the server specified by IP/Port number. We'd like to be able to detect if there is a server on the local network via UDP broadcasting, and can write a console app that does that. Problem is, how do we pass the information from the console app to the installer?

我可以捕获返回代码,但这只能是一个整数.据我所知,Inno Setup中唯一读取文件的功能是在预处理器中,因此我们无法读取控制台应用程序在运行时创建的文件.我唯一能想到的就是在端口之前返回一个整数,其中前4位是'.'和:的位置,然后解析出该值,这似乎有点笨拙,脆弱并且容易出错,尤其是考虑到我对构建字符串的Inno Setup语法/功能不是很熟悉.

I can capture the return code, but that can only be an int. As far as I can tell, the only functions to read file in Inno Setup is in the preprocessor so we can't read a file created at runtime by the console app. The only thing I can think of is to return an int where the first 4 digits are the position of the '.'s and : before the port and then parse out the value, which seems hackish, flimsy, and error prone, especially considering I'm not intimately familiar with Inno Setup syntax/functions for constructing a string.

有什么建议吗?

推荐答案

不知道如何从命令行加载参数,但是可以使用LoadStringFromFile加载文件的内容或使用GetIniString加载文件.从ini文件中读取参数.

Don't know how to load a parameter from the command line, but you can use LoadStringFromFile to load the contents of a file or GetIniString to read a parameter from an ini file.

通常,在Inno Setup帮助文件中查找支持功能参考".此页面将为您提供所有Inno功能的列表(不包括预处理器).如果找不到该页面(如果您仅找到有关预处理器的信息),则可能是因为查找了错误的帮助文件.请注意,"Inno Setup帮助"目录不是很好,但是索引很好.

More generally, look for "Support Functions Reference" in the Inno Setup Help file. This page will give you a list of all the Inno functions (not including the preprocessor). If you can't find this page (if you only find information about the preprocessor) then you may be looking in the wrong helpfile. Note that the Inno Setup Help table of contents isn't all that great but the index is very good.

命令行参数记录在设置命令行参数"页面上.您可能可以通过使用现有参数之一来欺骗Inno,但使用ini文件似乎是最简单的方法.

Command line parameters are documented on the page "Setup Command Line Parameters". It's possible that you might be able to trick Inno by using one of the existing parameters, but using an ini file seems like it would be the most straightforward approach.

这篇关于从命令行应用程序将字符串值传递给Inno Setup的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆