Archive: Executing a program after install


Executing a program after install
I'm installing a program using NSIS and would like to run the installed program after it installs. This is no problem if I add

!define MUI_FINISHPAGE_RUN "$INSTDIR\devcpp.exe"

to the Modern User Interface options.

My problem is that the program (devcpp.exe) seems to be running from within the install package directory and not the $INSTDIR. I know this because the devcpp.exe program searches for some directories at startup and can't find them (they are referenced as {current_dir}\include rather than as an absolute path like c:\dev-cpp\include).

If I run the program from outside of the NSIS installer, devcpp.exe finds the referenced directories just fine (I assume because the default directory is set correctly).

Has anyone run into this before?

Could I somehow do

!define MUI_FINISHPAGE_RUN "cd $INSTDIR; $INSTDIR\devcpp.exe"

to change the working directory first and then run the program using that working directory? (NOTE: That code doesn't seem to work).

Thanks.
-Tony


May be SetOutPath $INSTDIR in the finish page leave function? Or in the show function if installer runs program first. Not tested.


Use MUI_FINISHPAGE_RUN_FUNCTION instead of MUI_FINISHPAGE_RUN. In the defined function, use SetOutPath to set the current working directory prior to executing devcpp.exe.