Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 29th May 2007, 11:15   #1
Voxen06
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!
Voxen06 is offline   Reply With Quote
Old 29th May 2007, 11:43   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
http://www.microsoft.com/resources/d....mspx?mfr=true
http://www.microsoft.com/resources/d....mspx?mfr=true

Stu
Afrow UK is offline   Reply With Quote
Old 29th May 2007, 13:26   #3
Voxen06
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.
Voxen06 is offline   Reply With Quote
Old 29th May 2007, 14:34   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
You may have missed the 2nd link which I added a second later.

Stu
Afrow UK is offline   Reply With Quote
Old 29th May 2007, 15:35   #5
Voxen06
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.
Voxen06 is offline   Reply With Quote
Old 29th May 2007, 16:06   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
I came across this:
http://www.softtreetech.com/24x7/archive/53.htm

Stu
Afrow UK is offline   Reply With Quote
Old 19th December 2007, 20:43   #7
Anders
Moderator
 
Anders's Avatar
 
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
Anders is offline   Reply With Quote
Old 20th December 2007, 14:11   #8
grzech
Junior Member
 
grzech's Avatar
 
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.
grzech is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump