简体   繁体   English

在 NSIS 中访问命令行 arguments

[英]Accessing command line arguments in NSIS

I am trying to make my setups scripts modular.我正在尝试使我的设置脚本模块化。 I am calling setup exe's from within main setup script based to the requirements.我根据要求从主安装脚本中调用 setup exe。 I want to pass command line arguments to the exe being called.我想将命令行 arguments 传递给被调用的 exe。 Can someone please tell me how to access the command line arguments in the script being called.有人可以告诉我如何在被调用的脚本中访问命令行 arguments。

Thanks in advance.提前致谢。

you can use GetOptions function ( FileFunc.nsh must be included above).您可以使用GetOptions function (上面必须包含FileFunc.nsh )。 Following example shows p parameter reading;以下示例显示了p参数读取; its value is saved into the variable.它的值被保存到变量中。 $CMDLINE is your command line (absolute or relative, as you called) containing also your parameters. $CMDLINE是您的命令行(绝对或相对,如您所说),还包含您的参数。

!include FileFunc.nsh

Var variable    
${GetOptions} $CMDLINE "/p" $variable

Try to get options from Command line by their name: http://nsis.sourceforge.net/Get_command_line_parameter_by_name尝试按名称从命令行获取选项: http://nsis.sourceforge.net/Get_command_line_parameter_by_name

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM