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.

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

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.

[Run]
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.

Add comment

E-mail is already registered on the site. Please use the Login form or enter another.

You entered an incorrect username or password

Sorry, you must be logged in to post a comment.

Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Done