Inno Setup在[Files]节之前执行批处理文件 [英] Inno Setup Execute a batch file before [Files] section

查看:232
本文介绍了Inno Setup在[Files]节之前执行批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我的批处理文件位于[运行]部分.我需要我的批处理文件在[Files]节之前执行.在Inno Setup中有没有办法做到这一点?当前[Run]部分始终在[Files]部分之后执行.

Currently my batch file is in [Run] section. I need my batch file to execute before the [Files] section. Is there a way to do this in Inno Setup? Currently the [Run] section always execute after [Files] section.

[Run]
Filename: "C:\Users\Scripts\Install\Install.bat"; Parameters: {code:GetDatabaseName}  

[Files]
Source: "C:\Users\MyApp\*"; DestDir: "\\MyServer\MyApp"; Flags: recursesubdirs createallsubdirs

推荐答案

如果需要在安装开始时完成,请在PrepareToInstall()CurStepChanged(ssInstall)事件函数中使用Exec(). 这些都是在用户说继续安装"之后,然后再进行其他操作. PrepareToInstall()还允许您取消安装并发出警告.

If it needs to be done at the beginning of the setup, use Exec() in the PrepareToInstall() or CurStepChanged(ssInstall) event functions. These are both after the user has said "go ahead, install" but before anything else. PrepareToInstall() also allows you to cancel the install with a nice warning.

如果需要首先从设置中提取文件,则可以先使用ExtractTemporaryFile()

If the file needs to be extracted from the setup first, then you can preceed it with ExtractTemporaryFile()

这篇关于Inno Setup在[Files]节之前执行批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆