Can not run-as-administrator by Inno Setup

799 Views Asked by At

I create an installer by Inno setup. MyPro.exe installed by the installer should run as administrator in Win7. The following is the important part of the script. However, MyPro.exe still can not run as administrator and it can not write its profile in \System. Can you tell me which is wrong?

[Setup]
PrivilegesRequired=admin

[Icons]
Name: {group}\MyPro; Filename: {app}\MyPro.exe; Flags:

[Registry]
Root: "HKLM"; Subkey: "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers\"; ValueType: String; ValueName: "{app}\MyPro.exe"; ValueData: "RUNASADMIN"; Flags: uninsdeletekeyifempty uninsdeletevalue; MinVersion: 0,6.1

Root: "HKCU"; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: String; ValueName: "{app}\MyPro.exe"; ValueData: "RUNASADMIN"; Flags: uninsdeletevalue; MinVersion: 0,6.1
0

There are 0 best solutions below