ShortcutMake

Creates a shortcut for the specified filename or directory.

Syntax:

ShortcutMake(link-name, target, params, start-dir, show-mode[, shortcut-type])

Parameters:

(s) link-name the name of shortcut to be created. This can include file path information.

(s) target file or directory name which "link-name" will point to.

(s) params command-line parameters for "target" or NULL string.

(s) start-dir "Start in" directory for "target".

(i) show-mode "Run" mode for "target": 1 (@ICON), 2 (@NORMAL), or 3 (@ZOOMED).

(i) shortcut-type (optional) specifies the type of shortcut. see below

Returns:

(i)  @TRUE if the shortcut was successfully created; @FALSE if it wasn't.

 

This function can be used to create a shortcut file which points to a filename or to a directory.

"Link-name" the name of shortcut to be created. For a file shortcut you should specify the {filename}.LNK. For a directory shortcut specify just the name of the shortcut. For Example, to create a directory shortcut:

ShortcutMake("Test", "\\server\public\testdir\", "", "", @normal,1)

Note: In Windows 8.1 the "link-name" parameter may need full path information to successfully create the shortcut and avoid the 'Error saving shortcut file' error.

 

If "target" specifies a directory, the other parameters are meaningless.

Note: In the ShortcutMake and ShortcutEdit functions, if the "target" parameter specifies a UNC, and it does not exist at the time this function is called, then the "target" field in the shortcut may not be properly set. Specifically, it may get truncated after the share name. For example, if you use:

ShortcutMake("Test.lnk", "\\server\public\testdir\myprog.exe", "", "", @normal,0)

and \\server\public\testdir\myprog.exe doesn't exist, then the target of the share may get set to:

\\server\public 

This is due to the behavior of the API function we are calling, and is consistent with the behavior when trying to create or edit a shortcut interactively from Explorer (i.e., you are prevented from specifying an invalid target).

 

"Params" and "start-dir" are optional, and can be set to blank strings (""). "Show-mode" is optional, and can be set to 0.

 

"shortcut-type" specifies the type of shortcut, and can be one of the following:

Type Meaning

0  Normal shortcut (default) 

1  Folder shortcut (Windows 2000/XP only) 

Example:
;Create a shortcut to Notepad on the desktop
startdir=ShortCutDir( "Desktop", 0, 0 )
dest = StrCat( DirWindows(0), "notepad.exe" )
ShortCutMake( startdir:"\mynotepad.lnk", dest, "", "", @NORMAL, 0 )
ShortCutEdit( startdir:"\mynotepad.lnk", "", "", startdir, @NORMAL, 0 )
Exit
See Also:

ShortcutDir, ShortcutEdit, ShortcutExtra, ShortcutInfo