I have a program that unpacks to the TEMP directory, runs itself, then deletes itself from the TEMP directory. When the single-file executable that I generated with NSIS tries to run, UAC asks: "Do you want to allow the following program from an unknown publisher to modify your computer?"
To clarify: the installer only unpacks to the TEMP directory, and the program contained does not trigger UAC. I think it has to do with something NSIS does, but I can't figure out what or how to stop it. I've removed almost all of the lines of my NSIS script, and it still angers UAC.
If it matters, I'm using py2exe on python2.5 on Windows 7 with the pymunk and pygame libraries. (But again, it only triggers UAC when run through NSIS.)
How do I make it not tr开发者_开发技巧igger whatever UAC is up in arms about? Do I need a signing key?
RequestExecutionLevel user
This happens because NSIS is (wrongly) detected by windows as a installer that requires admin rights. MS added this detection without even asking the NSIS developers!
You might want to use $pluginsdir, it is auto deleted by nsis:
Section
InitPluginsDir
SetOutPath $pluginsdir
File myapp.exe
ExecWait '"$pluginsdir\myapp.exe"'
SetOutPath $temp ;make sure pluginsdir is not locked
SectionEnd
Windows has "installer detection" heuristics. You can suppress them by adding a manifest, either embedded in the exe or sitting next to it called whatever.exe.manifest, that says "I don't need to elevate". How to prevent Vista from requiring elevation on patch.exe? is the first of many many questions I found that cover this.
Installer detection heuristics are based almost entirely on the name of the file, so if for some reason you don't want to use a manifest, try renaming the file so as not to include the strings setup, update, patch, and the like.
精彩评论