I'm launching my Windows application this way after the installation completes:
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchApplication"
...
Function LaunchApplication
ExecShell "" "$INSTDIR\Application.exe"
FunctionEnd
But this has a strange and undesired side-effect. Apparently is my application launched with admin rights.
I cannot drag & drop any data between a web browser (tested with Firefox and IE) and my application.
If I quit my application (the session started from NSIS), and restart it from the start menu icon everything works! - I can drag & drop to the browsers without problems.
So I suspect since in the beginning of installation there is a UAC request, somehow UAC rights are transferred to the process I'm launching after installation. Since the browsers run in a low security process Windows refuses to exhange any data with them (in the process instance that is launched with NSIS).
How to launch an exe from NSIS, so that this UAC/security problem does not happen?
Try This:
!define MUI_FINISHPAGE_RUN "$INSTDIR\Application.exe"
!insertmacro MUI_PAGE_FINISH
OR
Function .oninstsuccess
Exec "$INSTDIR\Application.exe"
FunctionEnd
I recommend using the plugin ShellExecAsUser as mentioned by Anders. I use it for this exact same purpose like this:
!define MUI_FINISHPAGE_RUN_FUNCTION LaunchApplication
...
Function LaunchApplication
SetOutPath $INSTDIR
ShellExecAsUser::ShellExecAsUser "" "$INSTDIR\Application.exe" ""
FunctionEnd
Note the use of SetOutPath to ensure that Application.exe starts with installation folder as it's current directory. ShellExecAsUser does not set this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With