Inno Setup : How to set installer "Run As Administrator"?

健榮 陳 picture 健榮 陳 · Nov 9, 2012 · Viewed 29.9k times · Source

In Inno Setup,

[Setup] 
PrivilegesRequired=admin 

is still can not Run the installer as Administrator, but I need to Launch my Program at last step of Inno Setup.

How can I do to set my Installer can Run as Administrator ?

Answer

dwaddell picture dwaddell · Jul 23, 2015

I have been having this same problem as well, it took me quite a bit of time to figure out that after you have set the PrivilegesRequired=admin you also need to add runascurrentuser to all the [Run]Flags.

[Setup]
PrivilegesRequired=admin

[Run]
Filename: "{app}\MyApp.exe"; Description: "{cm:LaunchProgram,MyApp}"; Flags: runascurrentuser nowait postinstall skipifsilent; Check: returnTrue()
Filename: "{app}\MyApp.exe"; Flags: runascurrentuser; Parameters: "-install -svcName ""MyApp"" -svcDesc ""MyApp"" -mainExe ""MyApp.exe""  "; Check: returnFalse()

I know you have probably already figured out the issue considering this question was asked over two years ago but I thought I would answer it anyway for others like myself who found this unanswered question but would have really liked to have seen an answer.