|
![]() |
|
Thread Tools | Search this Thread | Display Modes |
![]() |
#1 |
Junior Member
Join Date: May 2007
Posts: 3
|
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! |
![]() |
![]() |
![]() |
#2 |
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
|
![]() |
![]() |
![]() |
#3 |
Junior Member
Join Date: May 2007
Posts: 3
|
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. |
![]() |
![]() |
![]() |
#4 |
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
You may have missed the 2nd link which I added a second later.
Stu |
![]() |
![]() |
![]() |
#5 |
Junior Member
Join Date: May 2007
Posts: 3
|
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. |
![]() |
![]() |
![]() |
#6 |
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
|
![]() |
![]() |
![]() |
#7 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,337
|
sample code @ http://blogs.msdn.com/oldnewthing/ar...9/6801084.aspx hopefully someone can convert it to system plugin code
IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#8 |
Junior Member
Join Date: Jul 2006
Posts: 31
|
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. |
![]() |
![]() |
![]() |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|