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

查看:28
本文介绍了是否可以使用 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 setup 不区分大小写.这是处理命令行选项的一种特别好的方式:它们刚刚出现.我希望有一种巧妙的方法让用户知道安装程序关心哪些命令行参数.

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.

顺便说一句,这使得@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天全站免登陆