• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 9. Scripting and Automation > Creating Windows and Internet Shortcuts i...

9.5. Creating Windows and Internet Shortcuts in Scripts

Include the following subroutine in your script to allow easy creation of Internet Shortcuts (*.url ) and Windows Shortcuts (*.lnk):

Sub Shortcut(LinkFile, CommandLine)
  Set WshShell = WScript.CreateObject("WScript.Shell")
  If LCase(Right(LinkFile, 4)) <> ".lnk" And _ 
         LCase(Right(LinkFile, 4)) <>".url" Then _
         LinkFile = LinkFile & ".LNK"
  Set ShortcutHandle = WshShell.CreateShortcut(LinkFile)
  ShortcutHandle.TargetPath = CommandLine
  ShortcutHandle.Save
End Sub


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint