VBScript Basics, Part 16 | Create Shortcuts


VBScripting (.vbs) Basic tutorial on how to create a shortcut. This works with both files and folders, and you can add a description, icon, and even quite a bit more.

Code Example:
______________________________________________________

Option Explicit
Dim obj, nLink

Set obj = CreateObject(“wscript.shell”)

Set nLink = obj.CreateShortcut(“C:UsersJeremyDesktopnewshortcut.lnk”)

nLink.TargetPath = “C:UsersJeremyDownloadsMusicIridescent – Linkin Park.mp3”
nLink.Description = “Link to my music file.”
nLink.IconLocation = “C:windowssystem32SHELL32.dll,137”
nLink.Save
______________________________________________________

Know the Basics:
——————————————————————————————
Option Explicit
Dim a, b
Set a = CreateObject(“wscript.shell”)
Set b = a.CreateShortcut(“LOCATIONSHORTCUT-NAME.lnk”)

b.TargetPath = “LOCATION OF ORIGINAL FILE”
b.Description = “DESCRIPTION”
b.IconLocation = “ICON LOCATION”
b.HotKey = “ALT+CTRL+N”
b.Save
——————————————————————————————



Leave a Comment