CreateShortcut()

Summary

Creates a shortcut (.lnk) file pointing to a program, file or a folder.

Syntax

CreateShortcut(string linkfile, array options)

Argument Contents
linkfile The path name for the link file
Option Type Contents
Target String The path to the target program, file or folder
Arguments String Arguments to pass to the program
Description String Description of the shortcut

Notes

  • The Description option is used for Tooltips help when the user hovers the cursor over the shortcut.

Example

info = GetProgram()
opts = null
opts.Target = info[1] //full path to the program executable
opts.Arguments = '-n "My Favorite App"' // the -n sets program title
opts.Description = "try clicking here" // Tooltips help
linkfile = "ClickMe.lnk"
CreateShortcut(linkfile, opts)

Error Codes

Error Type Meaning
Error linkfile is invalid, or Target could not be found

See Also

Function Summary
LaunchProgram() Starts a Windows program
ParseShortcut() Gets information from a shortcut (.lnk) file