Quick References
      ADO
      ASP
      CSS2
      HTML
      JavaScript
      Jet SQL
      VBScript
      WML
      WMLScript
      WSH
      XHTML
      XML DOM
      XSLT

Features
      Knowledge Base
      Tutorials

Partners
     ZVON.ORG
     XML
     Planet Source Code
     VisualBuilder
     Web Design
     Your HTML Source
     XML/XSLT Forums
     ASPAlliance
     Scripts
     
     Programmers Heaven
     Tek-Tips Forums
     Developer Fusion
     Code Project











Method:  WshShell.CreateShortcut

WshShell.CreateShortcut strPathName

The CreateShortcut method creates either a WshShortcut or WshURLShortcut object depending on the specified strPathName. If strPathName has the extension ".lnk", then a WshShortcut object is created and returned. If strPathName has the extension ".url", then a WshURLShortcut object is created and returned.

If strPathName points to a file that already exists, then the shortcut file is opened and can be modified via the shortcut object returned by CreateShortcut. Otherwise, the shortcut file will not be created until the Save method of the shortcut object is called.

The following VBScript code creates one program shortcut to Notepad and one URL shortcut to the DevGuru web site, then saves both shortcuts on the user's desktop.

Code:
Set WshShell = CreateObject("WScript.Shell")
strDesktopPath = WshShell.SpecialFolders("Desktop")

Set objShortcutLnk = WshShell.CreateShortcut(strDesktopPath & "\notepad.lnk")
objShortcutLnk.TargetPath = "notepad"
objShortcutLnk.Save

Set objShortcutUrl = WshShell.CreateShortcut(strDesktopPath & "\devguru.url")
objShortcutUrl.TargetPath = "http://www.devguru.com"
objShortcutUrl.Save


 


Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information