Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Allows you to create a shortcut to an Internet resource programmatically.
Remarks
.gif)
The WshUrlShortcut object is a child object of the WshShell object — you must use the WshShell method CreateShortcut to create a WshUrlShortcut object *(*e.g., WshShell.CreateShortcut(strDesktop & "\Shortcut Script.lnk")).
Example
The following example demonstrates the creation of a URL shortcut to www.microsoft.com.
<package>
   <job id="vbs">
      <script language="VBScript">
         set WshShell = WScript.CreateObject("WScript.Shell")
         set oUrlLink = WshShell.CreateShortcut(strDesktop & "\Microsoft Web Site.url")
         oUrlLink.TargetPath = "https://www.microsoft.com"
         oUrlLink.Save
      </script>
   </job>
   <job id="js">
      <script language="JScript">
         var WshShell = WScript.CreateObject("WScript.Shell");
         var oUrlLink = WshShell.CreateShortcut(strDesktop + "\\Microsoft Web Site.url");
         oUrlLink.TargetPath = "https://www.microsoft.com";
         oUrlLink.Save();
      </script>
   </job>
</package>
Properties
FullName Property (WshUrlShortcut Object) | TargetPath Property