Run an application shortcut after an install: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Adding new author and category links.)
Line 25: Line 25:
FunctionEnd
FunctionEnd
</highlight-nsis>
</highlight-nsis>
[[Category:Tutorials]]

Revision as of 05:39, 3 December 2005

Author: jpannequin (talk, contrib)


Description

Here is how to launch a shortcut at the end of an install (in the MUI). You may need this if you need to use a specific working directory and don't want to modify the MUI.

Usage

So suppose I want to launch "C:\User\test.lnk".

Before calling the macro for finish, you must define the run variables. If you define

!define MUI_FINISHPAGE_RUN "C:\User\test.lnk"

it will not work, because it is not an application.

You must set MUI_FINISHPAGE_RUN empty, and use a function instead.

!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_TEXT "Start a shortcut"
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
!insertmacro MUI_PAGE_FINISH

You can then define the function and execute the link with ExecShell.

Function LaunchLink
  ExecShell "" "C:\User\test.lnk"
FunctionEnd