Skip to content
⌘ NSIS Forum Archive

Run Program automatically after install?

12 posts

Panarchy#

Run Program automatically after install?

Hello

How do I run my program automatically after an install?

Tried following this guide: http://nsis.sourceforge.net/Run_an_a...ter_an_install but didn't work for me.

Here is my nsi;

!include MUI2.nsh

Name `Maintenance`
OutFile `Maintenance Installer.exe`

BrandingText `Created by Panarchy`

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE license.txt
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH

!insertmacro MUI_LANGUAGE English

Section

!macro ExtractMaintenance ToDir
SetOutPath `${ToDir}`
File "Maintenance Script.exe"
!macroend

!insertmacro ExtractMaintenance "C:\NoWhereInParticular"

CreateShortcut "$DESKTOP\Maintenance.lnk" "C:\NoWhereInParticular\Maintenance Script.exe"

SectionEnd
Please tell me how to integrate a 'run program on finish' feature.

Thanks in advance,

Panarchy
lewellyn#
I use something like this:

!define MUI_FINISHPAGE_RUN "$INSTDIR\${PROGEXE}"
!define MUI_FINISHPAGE_RUN_TEXT "Launch ${PRODUCTNAME}"
Yes, I !define PROGEXE and PRODUCTNAME early on in the script (along with lots of other potentially repetitive things). 🙂
Panarchy#
Thanks.

Just tried that, it didn't work.

Please recommend another method.

Thanks in advance,

Panarchy
lewellyn#
Can you define "it didn't work"? Did it cause compiler errors? Did it not show the checkbox? Did it not actually launch the exe?
ledruide#
and in silent mode...

Any idea on how to start an application after a silent install ?

Can't find anything yet....
Afrow UK#
Just put a Section at the end that does it, or use Function .onInstSuccess.

Edit: And if necessary wrap the code inside it with an ${If} ${Silent}.

Stu
th_mi#
Originally Posted by ledruide View Post
Function .onInstSuccess
Exec "blablabla.exe"
FunctionEnd
Only as a hint.

If your installer was elevated (under Vista or Seven), the executable started by "Exec" is also elevated. And it is not good to start the application with this privileges without any good reason.
msroboto#
I am using the UAC_AsUser_Execshell from the UAC plug-in.


This should prevent the program from running elevated.