clint
Posts: 139
Joined: Fri Jun 19, 2009 9:46 am
Location: Germany

Setting an Exe's Compatibility default mode at install

Is the Installer capable to mark a legecy exe to always run in a certain Compatibility mode (Explorer- Exe file - right click - Properties - Compatibility mode)?

Similar question for the "Run as Administrator" option on the same properties register, if the application is installed with elevated/Adimin. privileges, then can the installed exe's also be marked to always run with Admin privileges?
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Setting an Exe's Compatibility default mode at install

Hello,
Is the Installer capable to mark a legecy exe to always run in a certain Compatibility mode (Explorer- Exe file - right click - Properties - Compatibility mode)?
Unfortunately, we don't have predefined support for this. However you can take a look on "Running shortcuts in Compability mode" thread and you can try a similar workaround.
Similar question for the "Run as Administrator" option on the same properties register, if the application is installed with elevated/Adimin. privileges, then can the installed exe's also be marked to always run with Admin privileges?
In order to set an installed exe file to run elevated you should build the related exe with this option. For example you can embed an execution level manifest in it.

Also, please take a look on the following threads:
- "Setting "Run as Admin" for third-party exe"
- "Run VB EXE-File in Administrator Mode on Vista"

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
clint
Posts: 139
Joined: Fri Jun 19, 2009 9:46 am
Location: Germany

Re: Setting an Exe's Compatibility default mode at install

Daniel.Radu wrote:Hello,
clint wrote:Is the Installer capable to mark a legecy exe to always run in a certain Compatibility mode (Explorer- Exe file - right click - Properties - Compatibility mode)?
Unfortunately, we don't have predefined support for this. However you can take a look on "Running shortcuts in Compability mode" thread and you can try a similar workaround.
Ok. I can work with that! Thanks!
Daniel.Radu wrote:
clint wrote:Similar question for the "Run as Administrator" option on the same properties register, if the application is installed with elevated/Adimin. privileges, then can the installed exe's also be marked to always run with Admin privileges?
In order to set an installed exe file to run elevated you should build the related exe with this option. For example you can embed an execution level manifest in it.
As mentioned in the previous question above, (though not specifically pointed out in this question), this is a legecy app (Visual Studio 6) - so there is no way to add a manifest to it.
Daniel.Radu wrote:
Also, please take a look on the following threads:
- "Setting "Run as Admin" for third-party exe"
- "Run VB EXE-File in Administrator Mode on Vista"

All the best,
Daniel
Thank you!
Kashif Iqbal
Posts: 7
Joined: Fri Jan 17, 2020 5:30 pm

Re: Setting an Exe's Compatibility default mode at install

Is the Installer capable to mark a legecy exe to always run in a certain Compatibility mode (Explorer- Exe file - right click - Properties - Compatibility mode)?
Catalin
Posts: 7845
Joined: Wed Jun 13, 2018 7:49 am

Re: Setting an Exe's Compatibility default mode at install

Hello Kashif and welcome to Advanced Installer forums,

Unfortunately, we do not have predefined support for such a task.

However, this can still be manageable through a custom action.

For instance, the options from the "Compatibility" tab are reflected in the registry, in the following registry keys:

Code: Select all

HKCU:\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
or

Code: Select all

HKLM:\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
With that being said, we can have a custom action that will do just that

The custom action can look as it follows:

Code: Select all

$runCompatModeReg = "HKCU:\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"
$name = "C:\Users\Catalin\Desktop\sample.exe"
$value = "WIN8RTM"
New-ItemProperty -Path $runCompatModeReg -Name $name -Value $value -PropertyType string -Force | Out-Null
The $value variable can take a multitude of values, such as the ones presented in the article below:

https://www.verboon.info/2011/03/runnin ... lity-mode/

The custom action should be added as a "PowerShell Inline Script" (in the "Custom Actions" page) and it should be scheduled after the "Add Resources" action group, with its execution time being of "When the system is being modified (deferred)".

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Catalin
Posts: 7845
Joined: Wed Jun 13, 2018 7:49 am

Re: Setting an Exe's Compatibility default mode at install

Hello,

As a followup to my last thread: since this was requested in the past as well, I created a step-by-step How-To which explains how this can be achieved.

You can have a look over it here:

Always run .EXE as administrator / in compatibility mode

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”