Windows 如何在Inno Setup的预处理器函数中使用预处理器变量

Windows 如何在Inno Setup的预处理器函数中使用预处理器变量,windows,inno-setup,Windows,Inno Setup,我尝试使用Exec()预处理器函数运行PowerShell脚本,但需要向其传递两个参数。我该怎么做?以下代码段不起作用 #define PSScript SourcePath + "\\UpdateJson.ps1" #define ConfigPath SourcePath + "\\ClientConfig.json" #expr Exec("PowerShell -NoProfile -ExecutionPolicy Bypass -File {#PSScript} {#ConfigP

我尝试使用
Exec()
预处理器函数运行PowerShell脚本,但需要向其传递两个参数。我该怎么做?以下代码段不起作用

#define PSScript  SourcePath + "\\UpdateJson.ps1"
#define ConfigPath  SourcePath + "\\ClientConfig.json"
#expr Exec("PowerShell -NoProfile -ExecutionPolicy Bypass -File {#PSScript} {#ConfigPath} Str({#BuildNumber})")

谢谢

使用
+
运算符,与您在
PSScript
ConfigPath
声明中使用它的方式相同

此外,需要单独使用参数

其他事项:
1) 如果路径包含空格,则应将路径用双引号括起来。
2) 默认情况下,Inno设置预处理器不需要转义反斜杠

#define PSScript  SourcePath + "\UpdateJson.ps1"
#define ConfigPath  SourcePath + "\ClientConfig.json"

#expr Exec("PowerShell", \
           "-NoProfile -ExecutionPolicy Bypass -File """ + PSScript + """ " + \
               """" + ConfigPath + """ " + Str(BuildNumber))