Version 1 of Windows shortcut

Updated 2005-07-24 23:48:53

Once upon a time, a specific extension called shortcut.dll [ref?] served in this role [ref to explanation of "Windows shortcut"]. With more recent versions of Tcl, though, the handiest approach is through tcom, as PT illustrated in a comp.lang.tcl follow-up which he composed as "a translation of a MS demo from the MSDN scripting pages":

     package require tcom
     set oShell [tcom::ref createobject "WScript.Shell"]
     set sDesktop [[$oShell SpecialFolders] Item "Desktop"]
     set oShortcut [$oShell CreateShortcut \
                   [file nativename \
                     [file join $sDesktop "Tcl Shortcut Demo.lnk"]]]
    $oShortcut TargetPath [file nativename [file normalize [info script]]]
    $oShortcut WindowStyle 1
    $oShortcut Description "Demonstrate shortcut handling with Tcl"
    $oShortcut Save



...