1 [Files] 2 Source: "C:\Documents and Settings\Administrator\桌面\4\abc.exe"; DestDir: "{app}"; Flags: ignoreversion 3 Source: "C:\Documents and Settings\Administrator\桌面\4\vccrt8_Win32.msi"; DestDir: "{app}"; Flags: ignoreversion; AfterInstall: MyAfterInstall 4 ; 注意: 不要在任何共享系统文件上使用“Flags: ignoreversion” 5 6 [Icons] 7 Name: "{commonprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" 8 Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon 9 10 [Run] 11 ;Filename: "msiexec.exe"; Parameters: "/i ""{app}\vccrt8_Win32.msi"" /quiet";Description:"安装动态库"; StatusMsg:"正在安装必须的文件" 12 Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName,‘&‘,‘&&‘)}}"; Flags: Nowait postinstall skipifsilent 13 14 [CODE] 15 procedure MyAfterInstall; 16 var 17 RetCode: integer; 18 begin 19 ShellExec(‘open‘,ExpandConstant(‘{app}\vccrt8_Win32.msi‘),‘‘,‘‘,SW_SHOWnorMAL,ewWaitUntilTerminated,RetCode); 20 if RetCode <> 0 then 21 MsgBox(SysErrorMessage(RetCode),mbinformation,MB_OK); 22 end;
不知道为什么Exec不成功,必须用ShellExec才可以。
另外,在[Run]下注释的方法也是可行的,但