My Inno Setup脚本在使用#expr
编译时运行批处理脚本,如下所示:
#expr Exec("build.bat", null, null, 1)
根据设计,#expr
忽略了Exec()
调用的返回值。这会默默地丢弃任何错误,这在我的情况下是不可取的。
当Exec()
失败时,是否可以使Inno Setup停止编译?
使用#if
和#error
指令:
#if Exec("build.bat", null, null, 1) != 0
#error The build batch has failed
#endif