Create a Desktop shortcut using WSH

If you want to create a shortcut programatically use the code below. Found somewhere on net

'Create a Desktop ShortCut
set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
set oShellLink = WshShell.CreateShortcut(strDesktop & "\Shortcut To Notepad.lnk")
oShellLink.TargetPath = "Notepad.exe" 'WScript.ScriptFullName
oShellLink.WindowStyle = 1
oShellLink.Hotkey = "CTRL+SHIFT+N"
oShellLink.IconLocation = "notepad.exe, 0"
oShellLink.Description = "Shortcut To Notepad."
oShellLink.WorkingDirectory = strDesktop

Leave a Reply

Your email address will not be published. Required fields are marked *