Archive: How to create a shortcut with "Run as administrator" checked


How to create a shortcut with "Run as administrator" checked
Hi,

I need NSIS to create my application's shortcut with "Run as administrator" checked by defaut, because otherwise the application auto-update feature doesn't work (updated .exe cannot be written to C:\Program Files).

I tried to set RequestExecutionLevel admin but it doesn't help.

Is it possible to do that from NSIS? I really don't want to ask customers to manually set this checkbox manually after the installation.

Thanks for your help!


http://www.microsoft.com/resources/d....mspx?mfr=true
http://www.microsoft.com/resources/d....mspx?mfr=true

Stu


I'm not sure this is what I need.

The "runas" will ask for administrator password each time the application is launched, right?

I need that application runs as administrator when the user double click on the shortcut, exactly like if he does check the "Run as administrator" from the shortcut properties.


You may have missed the 2nd link which I added a second later.

Stu


Thanks for your help, but it still doesn't make it.

I tried to create a shortcut with this:
runas /user:ComputerName\administrator "C:\Program Files\App\App.exe"

When I double click the shortcut, it opens a command line window that asks for my password.

The shortcut is a half part of the problem, because my application is also started with Windows (from the registry's Run key) and it has to start with administrator privileges too.


I came across this:
http://www.softtreetech.com/24x7/archive/53.htm

Stu


sample code @ http://blogs.msdn.com/oldnewthing/ar...9/6801084.aspx hopefully someone can convert it to system plugin code


Here is the full code with error handling I wrote for that:
http://forums.winamp.com/showthread....hreadid=278764

It's C++ though. I put that in our dll and simply executed upon successful install using rundll32.


PS. Sorry for bumping an old thread - mistake due to message filtering.