Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set "Run as Administrator" for shortcut automaticlly

In Windows 7, you can set a property of a shortcut to "Run as Administrator", so that the application is invoked with Administrator privileges or the user is asked for an admin account.

I know I can request/force Administrator privileges with a manifest file for my application, but I need to set the privileges for applications that are not mine. As Installer Software I use SetUp Factory 8. It will create a shortcut but doesn't set "Run as Administrator".

So far I set the option with every customer manually after install but that is a lot of work.

How can I set "Run as Administrator" for application shortcuts via a program/script (like editing the shortcut) or in any other way.

like image 645
TalkingCode Avatar asked Sep 15 '10 10:09

TalkingCode


People also ask

How do I make a program always run as a different user?

By default, items in Windows Start Menu do not have a “Run As” option. In order to add the “Run as different user” option, enable the “Show Run as different user command on Start” policy in User Configuration -> Administrative Templates ->Start Menu and Taskbar section of the Local Group Policy Editor (gpedit. msc).

How do I force a program to run as administrator in Windows 11?

Right-click the app and choose Properties in the context menu. In the Properties window, switch to the Compatibility tab at the top. Here, toggle the option that says Run this program as an administrator. Click OK to save your changes and close the Properties window.


1 Answers

You know that you can embed a manifest, but it seems like you don't know you can also have an external manifest. You don't need to compile the executable for this. Just name the file whatever.exe.manifest and put it in the same folder as whatever.exe. If that manifest says requireAdministrator, you'll request elevation on every run. Have your installer copy the manifest wherever it copies the exe.

like image 142
Kate Gregory Avatar answered Oct 03 '22 14:10

Kate Gregory