Copy shortcut to desktop using script

Reading Time: < 1 minute

If you wish to copy a shortcut to a desktop using a VB Script, copy the below code to a notepad, amend the path on line 6 and save as a .vbs file. e.g. test.vbs

Set objFSO = CreateObject(“Scripting.FileSystemObject”)
Set objShell = CreateObject(“WScript.Shell”)
Set objProcess = objShell.Environment(“Process”)
strDesktop = objProcess.Item(“UserProfile”) & “\Desktop\”
boolOverwrite = False
objFSO.CopyFile “\\server\share\shortcut.lnk”, strDesktop, boolOverwrite

Or

If you’re using redirected folders, try the below code:

Const DESKTOP = &H10&
Set objFSO      = CreateObject(“Scripting.FileSystemObject”)
Set objAppshell = CreateObject(“Shell.Application”)
Set objFolder = objAppShell.Namespace(DESKTOP)
strFilePath = objFolder.Self.Path & “\”
objFSO.CopyFile “\\server\sharename\Shortcut.lnk”,strFilePath,True

Always test before pushing out to a live environment