Solved: Requested Operation Requires Elevation with Inno Setup

Solved: Requested Operation Requires Elevation with Inno Setup

I was using Inno Setup to compile a program and its dependencies into single packaged application. I’ve had encountered an issue like this before where I get an error after the setup installation and tried to automatically launch the app using the installed shortcuts.

Launch The Machine

The error says: “CreateProcess failed; code 740. The requested operation requires elevation.” as you can see below.

Inno Setup Error after installation

That error means that the requested operation requires administrative privileges to successfully launch the app.

I found out two solutions for this scenario.

Solution #1: Run as Administrator

If you’re using an administrator or any account with administrative privileges, you can simply run the installer with an elevated privileges by right-clicking on the app and choose “Run as Administrator“.

After trying the first solution, I’ve never seen the error anymore.

Solution #2: Add the shellexec flag

When you distribute an app to several users, you don’t want to scare and make them panic that the installer is throwing them up errors. Where in fact the installation was completed and the only problem was when launching or running the app for the first time.

Why not fix the issue during the compilation of the package so the users won’t see that scary popups.

As have been answered by Martin Dimitrov in SO, I simply added the shellexec flag right after the postinstall flag in the [Run] section of my compiler configuration. See below snippet below.

Filename: {app}\{#MyAppExeName}; Description: {cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}; Flags: nowait postinstall shellexec skipifsilent

Inno Setup will then launch the application using the “ShellExecute” function instead of “CreateProcess”. That might bring up the UAC settings window, not in my case, and run the application with elevated privileges.

Cromwell Bayon

He is a self-tutored programmer and a Full-Stack Developer. He strives to excel in the newest technology as possible. He has a very high sense of technicality and analytical skills which allows him to resolve any kind of issues related to technology. He also loves woodworking. Read more about him here...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.