Page 1 of 1

"Run this program as administrator" flag gone after installi

Posted: Thu Jul 11, 2013 7:37 am
by Zanko
Hi,

I have the flag "Run this program as administrator" on the main executable in the application my (actual) installer installs.
The source file have the flag enabled, but the installed executable has got this flag lost.

Is there any way to preserve it?

Re: "Run this program as administrator" flag gone after inst

Posted: Fri Jul 12, 2013 5:55 am
by Leo
In order to add the attribute "Run this program as administrator" to a file you need to add the following registry key (on the System\Registry tab):

Code: Select all

For All Users:
Registry Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
For Curent User:
Registry Key: HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
ValueName: <InstallDir>\file.exe 
Value Type: REG_SZ
ValueData: RUNASADMIN
Where <InstallDir>\file.exe is a required file.

Re: "Run this program as administrator" flag gone after inst

Posted: Sun Mar 09, 2014 9:43 pm
by mucio77
Thanks for the add.

Re: "Run this program as administrator" flag gone after inst

Posted: Thu Jul 18, 2019 1:45 pm
by AndrevanHaren
I am trying to make this work as well for my app. The program runs fine after the installation is finished and run from within the installer app, but when I try to run my app after that again, I get all kind of errors, because it is not being launched as an administrator.

I tried the solution given here, but it doesn't work for me. Probably because I am not running Window NT but Windows 10? If so, how does the installer knows where to place the registry code when other windows version are being used? What would be the correct path for Windows 10?

Re: "Run this program as administrator" flag gone after inst

Posted: Thu Jul 25, 2019 6:40 am
by Leo
try this:

Code: Select all

Bitness: Default
Registry Key: HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
ValueName: type the path to the file, e.g.<InstallDir>\file.exe
Value Type: REG_SZ
ValueData: RUNASADMIN
also try
ValueData: ~ RUNASADMIN
Overwrite: yes
Remove on uninstall: yes