对于安装MySQL默默的,我在cmd中尝试下面的命令,它工作正常:
msiexec /i "mysql-essential-6.0.11-alpha-winx64.msi" /qn
但是,我怎么能运行该命令在Inno Setup的安装之前 ?
对于安装MySQL默默的,我在cmd中尝试下面的命令,它工作正常:
msiexec /i "mysql-essential-6.0.11-alpha-winx64.msi" /qn
但是,我怎么能运行该命令在Inno Setup的安装之前 ?
你可以通过调用执行它Exec
从功能CurStepChanged
事件的方法,当步将ssInstall
。 在显示在下面的脚本,如何将包括MySQL的安装到您的设置以及如何提取并执行安装开始前权:
#define MySQLInstaller "mysql-essential-6.0.11-alpha-winx64.msi"
[Files]
Source: "{#MySQLInstaller}"; Flags: dontcopy
[Code]
procedure CurStepChanged(CurStep: TSetupStep);
var
Params: string;
ResultCode: Integer;
begin
if (CurStep = ssInstall) then
begin
ExtractTemporaryFile('{#MySQLInstaller}');
Params := '/i ' + AddQuotes(ExpandConstant('{tmp}\{#MySQLInstaller}')) + ' /qn';
if not Exec('msiexec', Params, '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
MsgBox('Installation of MySQL failed. Exit code: ' + IntToStr(ResultCode),
mbInformation, MB_OK);
end;
end;
利用未使用的进度条:
由于需要一定的时间的MySQL安装完成之前,你已经决定隐藏安装程序(还有什么可能是反正挺不安全)的用户界面,您可以扩展脚本使用其在显示进度条的在安装过程中的起始位置,并且未使用的那段时间。 下面的代码开关的创新安装的安装进度条(至少在Windows XP系统),以marquee style
,并显示在状态标签的说明。 当MySQL安装完成后,进度条切换回正常模式和实际Inno Setup的安装开始:
#define MySQLInstaller "mysql-essential-6.0.11-alpha-winx64.msi"
[Files]
Source: "{#MySQLInstaller}"; Flags: dontcopy
[Code]
procedure CurStepChanged(CurStep: TSetupStep);
var
Params: string;
ResultCode: Integer;
begin
if (CurStep = ssInstall) then
begin
WizardForm.ProgressGauge.Style := npbstMarquee;
WizardForm.StatusLabel.Caption := 'Installing MySQL. This may take a few minutes...';
ExtractTemporaryFile('{#MySQLInstaller}');
Params := '/i ' + AddQuotes(ExpandConstant('{tmp}\{#MySQLInstaller}')) + ' /qn';
if not Exec('msiexec', Params, '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
MsgBox('Installation of MySQL failed. Exit code: ' + IntToStr(ResultCode),
mbInformation, MB_OK);
WizardForm.ProgressGauge.Style := npbstNormal;
WizardForm.StatusLabel.Caption := '';
end;
end;