WshShell.CreateShortcut

The CreateShortcut method creates a WshShortcut object and returns it. If the shortcut title ends with .url, a WshURLShortcut object is created.

Syntax

WshShell.CreateShortcut(strPathname) = objShortcut
 

Example

' This code fragment creates a shortcut 
' to the currently executing script
    Set WshShell = Wscript.CreateObject("Wscript.Shell")
    Set oShellLink = WshShell.CreateShortcut("Current Script.lnk")
    oShellLink.TargetPath = Wscript.ScriptFullName
    oShellLink.Save
    Set oUrlLink = WshShell.CreateShortcut("Microsoft Web Site.URL")
    oUrlLink.TargetPath = "http://www.microsoft.com"
    oUrlLink.Save

See Also

WshShortcut object, WshUrlShortcut object