Search code examples
installationnsisshortcut

nsis installer create shortcut error , creating shortcut of a batch file assigns an unknown start in value


I am creating a shortcut of a batch file in the installation directory. I also have a ZIP folder inside the installation directory.

$INSTDIR is given by the user on the Directory dialog as : E:\myfolder

When the installer creates the shortcut, then on viewing the PROPERTIES of that shortcut file, i found that Start in : is = E:\myfolder\ZIP , why so?

i want that it should be E:\myfolder.

I don't know why it is adding that "ZIP" in the Start in value?

  CreateShortCut "$INSTDIR\mySOFTWARE.lnk" "$INSTDIR\mysoftware.bat"

Solution

  • CreateShortcut uses $outdir as the start in folder, so if you need a specific start in folder you must use SetOutPath before calling CreateShortcut:

    SetOutPath "$INSTDIR"
    CreateShortcut "$INSTDIR\mySOFTWARE.lnk" "$INSTDIR\mysoftware.bat"
    

    The other alternative is to use a specific path in your batch file, "%~dp0" is the path to the folder the .bat is in.