Make Inno Setup installer request privileges elevation only when needed

Inno Setup 6 has a built-in support for non-administrative install mode. Basically, you can simply set PrivilegesRequiredOverridesAllowed: [Setup] PrivilegesRequiredOverridesAllowed=commandline dialog Additionally, you will likely want to use the auto* variants of the constants. Notably the {autopf} for the DefaultDirName. [Setup] DefaultDirName={pf}\My Program The following is my (now obsolete) solution for Inno Setup 5, based on … Read more

How can I auto-elevate my batch file, so that it requests from UAC administrator rights if required?

There is an easy way without the need to use an external tool – it runs fine with Windows 7, 8, 8.1, 10 and 11 and is backwards-compatible too (Windows XP doesn’t have any UAC, thus elevation is not needed – in that case the script just proceeds). Check out this code (I was inspired by the … Read more

How do I force my .NET application to run as administrator?

You’ll want to modify the manifest that gets embedded in the program. This works on Visual Studio 2008 and higher: Project + Add New Item, select “Application Manifest File”. Change the <requestedExecutionLevel> element to: <requestedExecutionLevel level=”requireAdministrator” uiAccess=”false” /> The user gets the UAC prompt when they start the program. Use wisely; their patience can wear out quickly.