Reputation:
I have this following code with Inno Setup.
But how can I apply this similar function to .msi file?
msiexec /I "\package\file.msi" /qb
? How?
procedure AfterMyProgInstall(S: String);
var
ErrorCode: Integer;
begin
{MsgBox('Please wait the libraries are getting installed, ' +
'without the libraries it wont work.', mbInformation, MB_OK);}
ExtractTemporaryFile(S);
{SW_SHOW, SW_SHOWNORMAL, SW_SHOWMAXIMIZED, SW_SHOWMINIMIZED, SW_SHOWMINNOACTIVE, SW_HIDE}
ShellExec('', ExpandConstant('{app}\package\' + S), '', '', SW_SHOWNORMAL,
ewWaitUntilTerminated, ErrorCode);
end;
Upvotes: 13
Views: 25012
Reputation: 31
Although kobik's option to use "msiexec.exe /i" in Run section generally works, we faced a problem of admin right downgrade with it:
[Run]
Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\file.msi"" /qb"; WorkingDir: {tmp};
When msiexec.exe /i file.msi runs this way it requests the admin rights with UAC (as expected, it is really required in our case). But somewhere in the middle of this installation part when "file.msi" is trying to start a windows service it appeared to be right-downgraded and have not enough privileges to start windows service. However when it's launched via shellexec it goes ok without this problem. So this is how it worked to me:
[Run]
Filename: "{tmp}\file.msi"; Flags: skipifsilent shellexec waituntilterminated hidewizard;
Upvotes: 2
Reputation: 427
Building on the answer @kobik gave. I had to include the '.exe' in the Filename. Like so:
if not ShellExec('', 'msiexec.exe', ExpandConstant('{tmp}\package\file.msi'),
'', SW_SHOWNORMAL, ewWaitUntilTerminated, ErrorCode)
then
MsgBox('Msi installer failed to run!' + #13#10 + ' ' +
SysErrorMessage(ErrorCode), mbError, MB_OK);
Upvotes: 4
Reputation: 21252
Try this:
ShellExec('', 'msiexec.exe',
ExpandConstant('/I "{tmp}\package\file.msi" /qb'),
'', SW_SHOWNORMAL, ewWaitUntilTerminated, ErrorCode);
Or:
[Files]
Source: file.msi; DestDir: {tmp}; Flags: deleteafterinstall;
[Run]
Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\file.msi"" /qb"; WorkingDir: {tmp};
Upvotes: 31
Reputation: 41
Note that: I'm using Inno Setup 5.5.3 on Windows 7, and that this code
is for the Inno Setup script in the run section. With this code you can
run msi
files without any problems. Here is the code:
[Run]
Filename: `{src}\PhysX.msi;` Description: Nvidia PhysX; Verb: open; Flags: shellexec postinstall waituntilterminated runascurrentuser skipifsilent
Upvotes: 4