Pascal Scripting: CreateShellLink

Prototype:

function CreateShellLink(const Filename, Description, ShortcutTo, Parameters, WorkingDir, IconFilename: String; const IconIndex, ShowCmd: Integer): String;

Description:

Creates a shortcut to a file or folder. Returns the resulting filename of the link, which may differ from Filename if it ended up creating a .pif file instead of a .lnk file. On failure, an exception will be raised.

Parameters:
Filename
Filename of the shortcut file to be created. This should be the full path and must end with ".lnk".
Description
Description of the link. This will be displayed on Windows 2000/XP and other supporting OS when the user hovers the mouse over the file or shows the properties.
ShortcutTo
Target file for the shortcut. This must be the full path to the file. Double quotation marks to surround the path will be added automatically.
Parameters
Parameters to pass to the target file of the shortcut. Parameters which may include spaces should have double quote marks surrounding them. e.g. ExpandConstant('"{app}\foo"')
WorkingDir
Working directory for the target file. This should be set to an absolute directory.
IconFilename
Path to file to supply the icon. If this is left as the empty string then the system default icon for the target file will be used.
IconIndex
Zero-based index of the icon.
ShowCmd
One of the SW_* constants

Remarks:

You will most likely want to remove this shortcut on uninstall. Do this by adding an entry to the UninstallDelete section.

Example:
CreateShellLink(
  ExpandConstant('{app}\config\Open licence database.lnk'),
  'Opens the licence database in SQLite',
  ExpandConstant('{app}\config\sqlite.exe'),
  ExpandConstant('"{app}\config\licences.db"'),
  ExpandConstant('{app}\config'),
  '',
  0,
  SW_SHOWNORMAL);