Desktop_CreateShortCut
Description
Section titled “Description”Creates a shortcut (.lnk file) in a specified folder. If the folder doesn’t exist, the function creates it.
In computer jobs, per-user folders such as Folder_Desktop and Folder_Programs belong to the account that runs the job. Use the all-users folders, for example Folder_AllUsersDesktop, to create shortcuts that every user sees.
Syntax
Section titled “Syntax”Desktop_CreateShortCut(sDescription, sShortcutFileName, sTargetPath, sArguments, sWorkingDirectory, sShortcutFolder, sIconLocation, iWindowStyle, sHotKey) As Boolean
Parameters
Section titled “Parameters”sDescription (String)
Section titled “sDescription (String)”A description for the shortcut (e.g. “Calculator”)
sShortcutFileName (String)
Section titled “sShortcutFileName (String)”Name of the .lnk file (e.g. Calc.lnk). If the name doesn’t end with .lnk, the function adds it.
sTargetPath (String)
Section titled “sTargetPath (String)”Full path to the application (e.g. C:\Windows\calc.exe)
sArguments (String)
Section titled “sArguments (String)”Commandline arguments, if any
sWorkingDirectory (String)
Section titled “sWorkingDirectory (String)”Working directory for the application
sShortcutFolder (String)
Section titled “sShortcutFolder (String)”You can use Special folders Constants together with a path
sIconLocation (String)
Section titled “sIconLocation (String)”Iconlocation (often found in the .exe file)
iWindowStyle (Integer)
Section titled “iWindowStyle (Integer)”Windows Style Constants (minimized, normal, maximized, etc.). 0 keeps the default window style of the shortcut.
sHotKey (String)
Section titled “sHotKey (String)”Hotkey for executing shortcut (e.g. CTRL+ALT+W)
Return value
Section titled “Return value”Boolean, TRUE if function completed successfully.
Example
Section titled “Example”'Creates a shortcut on the users start menuIf bStatus Then bStatus=Desktop_CreateShortCut("Creates CapaInstaller scripts","CapaInstaller Manager.lnk",gsProgramFiles & "\CapaInstaller Manager\ciman.exe","", gsProgramFiles & "\CapaInstaller Manager",Folder_Programs & "\CapaInstaller",gsProgramFiles & "\CapaInstaller Manager\Ciman.exe",0,"CTRL+ALT+C")
'Create a shortcut in c:\tempIf bStatus Then bStatus=Desktop_CreateShortCut("Creates CapaInstaller scripts","CapaInstaller Manager.lnk",gsProgramFiles & "\CapaInstaller Manager\ciman.exe","", gsProgramFiles & "\CapaInstaller Manager","C:\temp",gsProgramFiles & "\CapaInstaller Manager\Ciman.exe",0,"CTRL+ALT+C")
'Creates a shortcut on all users desktopIf bStatus Then bStatus=Desktop_CreateShortCut("Create advanced CAD drawings","AutoCad 2000.lnk",gsProgramFiles & "\Autodesk\Autocad 2000\autocad.exe","/new /ddeexec=2", gsTempDir,Folder_AllUsersDesktop,gsProgramFiles & "\Autodesk\AutoCad\Autocad.ico",0,"")
'Creates a shortcut to notepad in the Send To folder.If bStatus Then bStatus=Desktop_CreateShortCut("","Notepad.lnk",gsWindowsDir & "\notepad.exe","", gsTempDir,Folder_SendTo,gsWindowsDir & "\notepad.exe",0,"")