我尝试使用Exec()
预处理程序功能运行PowerShell脚本,但是我需要向其传递两个参数。我怎样才能做到这一点?以下代码段无效。
#define PSScript SourcePath + "\\UpdateJson.ps1"
#define ConfigPath SourcePath + "\\ClientConfig.json"
#expr Exec("PowerShell -NoProfile -ExecutionPolicy Bypass -File {#PSScript} {#ConfigPath} Str({#BuildNumber})")
谢谢!
答案 0 :(得分:1)
使用+
运算符,就像在PSScript
和ConfigPath
声明中已经使用它一样。
此外,Exec
function分别需要参数。
其他内容:
1)如果路径中包含空格,则应将其包装为双引号。
2)默认情况下,Inno Setup预处理程序不需要转义反斜杠。
#define PSScript SourcePath + "\UpdateJson.ps1"
#define ConfigPath SourcePath + "\ClientConfig.json"
#expr Exec("PowerShell", \
"-NoProfile -ExecutionPolicy Bypass -File """ + PSScript + """ " + \
"""" + ConfigPath + """ " + Str(BuildNumber))