Creating Shortcuts to Folders

InstallShield 2022

Project:This information applies to the following project types:

Basic MSI
DIM
InstallScript
InstallScript MSI
InstallScript Object
Merge Module
MSI Database
MSM Database
Transform

InstallShield lets you create a shortcut to a folder. The method that you use to create a shortcut to a folder depends on the project type that you are using.

Basic MSI, DIM, InstallScript MSI, Merge Module, MSI Database, MSM Database, and Transform Projects

The Target setting of a shortcut can contain a directory identifier inside square brackets. For example, to create a shortcut to INSTALLDIR, create a shortcut with the following settings:

Display Name: Shortcut to INSTALLDIR
Advertised: No
Target: [INSTALLDIR]

InstallScript and InstallScript Object Projects

The AddFolderIcon function creates a shortcut to a folder if you pass the path to the folder in the third (szCommandLine) parameter.

For example, this code creates a shortcut to the Common Files folder in the end user’s Program Files folder:

ProgDefGroupType(COMMON)

 

szFolder = TARGETDIR;

LongPathToQuote(szFolder, TRUE);

 

AddFolderIcon(

    ProgramMenuFolder,        // where shortcut will appear

    "Shortcut to TARGETDIR",  // shortcut display name

    szFolder,        // what shortcut launches

    ""// working directory

    TARGETDIR ^ "Sample.exe", 0,       // icon file, index

    "",    // shortcut key

    NULL);              // special settings

InstallScript MSI Project

Use the same basic procedure as in the preceding InstallScript section, changing all occurrences of TARGETDIR to INSTALLDIR in the example code.