Skip to content
⌘ NSIS Forum Archive

Launching program from installer

5 posts

weridoman#

Launching program from installer

How can i have the installer launch my program when the installation is finished? Is it also possible to launch other programs when the install finishes (and how)?
Gonzotek#
EXEC DRIVE:\PATH\PROGRAM.EXE
Use $INSTDIR for DRIVE:\PATH\ if that works with your installation.

You can just EXEC several programs (if you need too) right before the end of your install.

If you are looking to use the installer on a cd that will need to be in the computer for your program to run, I posted instructions for that awhile back, search the forums or ask me and I'll try to remember.
-=Gonzotek=-
weridoman#
Can you please tell me how to exec a program off of the cd? i tried lookin in the forums, but time does not allow me to do a thorough search.


Thanx
🙂
DuaneJeffers#
Try this. Use the adaptive HTML Launcher to run a program off of the CD.

Name "EXE DIR Launcher"
OutFile autorun.exe
SilentInstall silent
Icon CD.ico

Section ""
ExecShell open "$EXEDIR\myprogram.exe"
SectionEnd
or use my copyrighted HTML Launcher:

Name "EXE DIR Launcher"
OutFile autorun.exe
SilentInstall silent
Icon CD.ico

Section ""
ExecShell open "$EXEDIR\index.html"
SectionEnd
or to open the CD drive:

Name "EXE DIR Launcher"
OutFile autorun.exe
SilentInstall silent
Icon CD.ico

Section ""
ExecShell open "$EXEDIR"
SectionEnd
Hope that helps
-DJ
saivert#
News

As per version 1.44 of NSIS you should use the .onInstSuccess function to execute programs ans so on at the end of install. This assures that the instruction only get executed when the installation is successfull. Check this sample NSI script:

Name ".OnInstSuccess Sample"
OutFile oninstsuccess_sample.exe
InstallDir "$PROGRAMFILESDIR\onInstSuccess Sample\"

Section
CreateDirectory $INSTDIR
SectionEnd

Function .onInstSuccess
Exec $INSTDIR
FunctionEnd

; Function .onInstSuccess gets called automatically at install success.