Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run application after install(silent installer)

Tags:

nsis

I want to run my application immediately after install and I understand the code to do it is as follows:

!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
!insertmacro MUI_PAGE_FINISH

Section
CreateShortcut "$DESKTOP\HelloWorldShortcut.lnk" "$INSTDIR\Hello World.exe" "dev03 3" 
SectionEnd    

Function LaunchLink
ExecShell "" "$DESKTOP\HelloWorldShortcut.lnk"
FunctionEnd

The problem is my installer is a silent installer but the above code adds a page to it.

Is there a way to use a silent installer to also run the application immediately after install?

like image 535
user111 Avatar asked Sep 06 '25 03:09

user111


1 Answers

A silent installer can just run the app as the final step in the last section. Whether or not it is a good idea for a silent installer to start the application is something you should think about, personally I would say no...

Section
SetOutPath $InstDir
File "MyApp.exe"
...

IfSilent "" +2 ; If the installer is always silent then you don't need this check
ExecShell "" "$InstDir\MyApp.exe"
SectionEnd
like image 118
Anders Avatar answered Sep 07 '25 22:09

Anders