CreateShortcut Method

Top  Previous  Next

Creates a shortcut (shell link).

[VBScript]

Installer.CreateShortcut ShortcutPath, ObjectPath, Description, _

      Parameters, WorkingDir, IconLocation, _

      IconIndex, ShowCommand, HotKey

 

[JScript]

Installer.CreateShortcut(ShortcutPath, ObjectPath, Description,

      Parameters, WorkingDir, IconLocation,

      IconIndex, ShowCommand, HotKey);

Parameters

ShortcutPath

The target shortcut path.

ObjectPath

The path to Shell link object (file, folder).

Description

The description string.

Parameters

The shortcut command parameters (for executable objects only).

WorkingDir

The working directory where the shortcut will be opened.

IconLocation

The path to shortcut icon location. Use with IconIndex. To omit this parameter, use empty string.

IconIndex

The 0-based index of icon in the icon container. Use 0 for .ico files and icon order number for executables and icon libraries (.exe, dll, .icl).

ShowCommand

The numeric window state value (see below). Use 0 to omit this parameter.

HotKey

The numeric Hot Key value (valid for Desktop links only). Refer to MSDN for valid keys values. Use 0 to omit this parameter.

Remarks

Installer variables are supported in the following parameters: ShortcutPath, ObjectPath, Description, Parameters, WorkingDir and IconLocation. To emit the value of installer variable MyVar, use the form ${MyVar}.

The ShowCommand parameter supports the following values:

Constant

Windows API Name

Description

1

SW_SHOWNORMAL

Open the shortcut in a normal window.

2

SW_SHOWMINIMIZED

Open the shortcut in a minimized window.

3

SW_SHOWMAXIMIZED

Open the shortcut in a mazimized window.

Uninstall support

This action supports automatic uninstallation.

Example (VBScript)

' Create shortcut to Windows calculator program

Installer.CreateShortcut "${DesktopPath}\Calc""${SystemPath}\calc.exe", _

  "The calculator program""param1""${ProductPath}", _ 

  "${SystemPath}\moricons.dll", 12, 0, 0

Example (JScript)

// Create shortcut to Windows calculator program

Installer.CreateShortcut("${DesktopPath}\\Calc""${SystemPath}\\calc.exe",

  "The calculator program""param1""${ProductPath}"

  "${SystemPath}\\moricons.dll", 12, 0, 0);