【发布时间】:2016-03-23 18:53:54
【问题描述】:
我正在尝试运行由 NSIS 生成的测试安装程序 (.exe),同时提供命令行参数。我正在使用GetParameters 和GetOptions。
我的代码:
FileOpen $0 "$InstDir\output.txt" w
${GetParameters} $R1
${GetOptions} $R1 "-pss" $R2
IfErrors 0 +3
FileWrite $0 "Success"
Goto done
FileWrite $0 "Fail"
done:
FileClose $0
以及运行时使用的命令:
installer.exe -pss
我在文本文件中不断收到Fail,但选项在命令行字符串中。我做错了什么?
我尝试使用/pss 而不是-pss,但这仍然给我一个错误。我也运行了相同的代码,但做了一些修改:
FileOpen $0 "$InstDir\output.txt" w
${GetParameters} $R1
${GetOptions} $R1 "-pss=" $R2 ;;revision
IfErrors 0 +3
FileWrite $0 "Success = $R2" ;;revision
Goto done
FileWrite $0 "Fail = $R2" ;;revision
done:
FileClose $0
使用命令installer.exe -pss=true 并将true 写入文件,这意味着$R1 正在接收一个值,但我仍然收到错误消息。
这里最重要的是我不需要任何实际值,而只需要查看 -pss 选项是否可用。
谁能告诉我我做错了什么或者我的误解在哪里?
【问题讨论】:
标签: command-line installation nsis