Archive: FileOpen as admin


FileOpen as admin
I am trying to open a file during the installation that needs to be run as an administrator. currently my code looks like this:

#find the Configure Virtual Printer File and run it
${FindIt} "C:" "ConfigureVirtualPrinter.exe" "$R0"
FileOpen $4 "$R0" w
FileRead $4 $1
FileClose $4

I do not want a box to popup asking for username and password credentials. I want the same effect as either right clicking on the program and saying run as admin or going into the command line and typing it. Is this possible to be done during the installation process when I open the file?


You cannot launch something as admin if you're not admin yourself. It is 100% impossible, unless you count zero-day exploits. The right-click 'run as admin' also pops a user/pass dialog. If you're using UAC on Vista or higher, and you're already an admin user, this box is replaced by a simple 'Yes/No' popup. But it's still the same thing.

To run an exe as admin, try searching the nsis forums for 'run as admin' for example, or just use runas.exe.