How to Create a Shortcut with VBScript

This script came in handy when I needed to roll out a desktop shortcut to every employee at the company I work for. The script sets fields of a shortcut. Very simple:

Set oWS = WScript.CreateObject("WScript.Shell")
   sLinkFile = "C:\Filename.lnk"
   
   Set oLink = oWS.CreateShortcut(sLinkFile)
   
	oLink.TargetPath ="""" & "C:\Program.exe" & """"
	oLink.Arguments = ""
	oLink.Description = "Program"
	oLink.HotKey = "ALT+CTRL+F"
	oLink.IconLocation = "C:\Program.exe, 2"
	oLink.WindowStyle = "1"
   	oLink.WorkingDirectory ="C:\"
   oLink.Save

Leave a Reply