可以使用Inno Setup接受自定义命令行参数 [英] Is it possible to accept custom command line parameters with Inno Setup

查看:3234
本文介绍了可以使用Inno Setup接受自定义命令行参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Inno Setup准备安装程序。但我想添加一个额外的自定义(没有可用的参数)命令行参数,并希望得到参数的值,如:

I am preparing an installer with Inno Setup. But I'd like to add an additional custom (none of the available parameters) command line parameters and would like to get the value of the parameter, like:

setup.exe /do something

检查 / do ,然后获取某个值的值。是否可以?

Check if /do is given, then get the value of something. Is it possible? How can I do this?

推荐答案

使用InnoSetup 5.5.5(或许还有其他版本),只需传递任何你想要的参数,前缀为 /

With InnoSetup 5.5.5 (and perhaps other versions), just pass whatever you want as a parameter, prefixed by a /

c:\> myAppInstaller.exe /foo=wiggle

并在myApp.iss中:

and in your myApp.iss:

[Setup]
AppName = {param:foo|waggle}

如果没有参数匹配, | waggle 提供了一个默认值。 Inno设置不区分大小写。这是一个特别好的方式来处理命令行选项:它们刚刚生存。我希望有一个光滑的方式让用户知道安装程序关心的命令行参数。

The |waggle provides a default value if no parameter matches. Inno setup is not case sensitive. This is a particularly nice way to handle command line options: They just spring into existence. I wish there was as slick a way to let users know what command line parameters the installer cares about.

BTW,这使得@ knguyen和@ steve-dunn的答案有点冗余。效用函数完全符合内置的{param:}语法。

BTW, this makes both @knguyen's and @steve-dunn's answers somewhat redundant. The utility functions do exactly what the built-in {param: } syntax does.

这篇关于可以使用Inno Setup接受自定义命令行参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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