I have created a patch file with an executable inside of it using Winrar SFX feature.
After executing the SFX file and the extraction ends up, my executable file will never run because it doesn't have admin privileges. I am wondering HOW I can grant administrator access to that file by some programming way (like a batch file).

I know that I can right click it, go to "Properties", choose "Compatibility" tab and then tick the box "Execute as Administrator".

The problem is that the users who will download that patch doesn't know it (and my exe only runs when you right click it and choose "Open as administrator", otherway it will never open nor display the UAC popup).

I have tried some ways, like the "Elevator Runner (Elevate me)", etc, but I'm actually looking for something simpler than.
I just need to make the exe always run as administrator.


2 Answers 2


What you need to do is embed an application manifest into the EXE.

  1. Save the following as a text file called App.exe.manifest:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
        <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
                    <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
  2. Download the Windows SDK.

  3. Inside you'll find mt.exe i.e. the Manifest Tool. Invoke it as follows:

    mt.exe -manifest "App.exe.manifest" -outputresource:"App.exe";#1
  4. If there are no errors you're done. You can delete the manifest file and distribute just the EXE. Running it should make it automatically request admin access every time.


  • I'll test it. By the way, is it possible to make this "Manifest" a bit better? Like doing it executing as Administrator without requesting Admin Access? Thanks Jun 7, 2013 at 21:43
  • Meaning you want it to silently elevate and gain admin access? Unless you turn off UAC that's not possible, otherwise what would be the point of UAC and don't you think every malware would be doing this?
    – Karan
    Jun 7, 2013 at 21:45
  • I understand your point, but I know that there are ways...not easy for sure, but there are, like the "Elevate Me" program...Anyway, making the exe run as admin is enough for now. Really thank you in advance Jun 7, 2013 at 22:04
  • 1
    All such programs to bypass the elevation prompt use the well-known Task Scheduler trick which requires admin access. Since you're looking to do this on any arbitrary PC where your SFX is executed, you can't silently create the scheduled task without the standard user's consent. In fact, if any program did this on my PC (silently create a scheduled task to bypass UAC), I would instantly classify it as malware and delete it.
    – Karan
    Jun 7, 2013 at 22:19
  • 1
    Pretty good Karan, worked perfectly. I would only suggest you to add to the answer the need of running CMD as ADMIN, otherwise it will not work...Thank you again Jun 13, 2013 at 0:26

When creating your archive, Request Administrative Access.enter image description here

  • MDMoore313 thanks for your time, but I guess I didn't explained myself well. I don't need to run SFX as admin. I need to run a specific file as admin ("my_app.exe"), which is located inside the SFX file. The point is that double clicking that file, won't make it run. The only way to run it is right clicking it and choose "Run as Administrator" Jun 7, 2013 at 14:40
  • @RafaelVidal does the SFX launch your application? If so, then your app will have admin rights. If not, I will update my answer.
    – MDMoore313
    Jun 7, 2013 at 14:44
  • No, it doesn't launch the application. The user has to do it manually, so he may tick the "Run as Adminsitrator" box on the "Compatibility" tab or right-click "Run as Administrator" context menu Jun 7, 2013 at 14:45
  • @RafaelVidal is there a reason you don't want WinRAR to launch the exe, and just have the user run the SFX itself? it seems like that would accomplish the same goal and solve your admin issue. If you're still focused on flagging your program to run as admin, you would have better chances of an answer on stack overflow (flag your question for migration)
    – MDMoore313
    Jun 7, 2013 at 15:33
  • The SFX do launches the file, but the users may run that file by themselves later on and then there will be no SFX to run it for then. That's why the exe need to be flagged as "run as admin" Jun 7, 2013 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.