Windows 脚本宿主  

WshUrlShortcut 对象

WshShell Object

允许以编程方式创建 Internet 资源的快捷方式。

说明

WshUrlShortcut 对象是 WshShell 对象的子对象 — 必须使用 WshShell 对象的 CreateShortcut 方法创建 WshUrlShortcut 对象(例如,WshShell.CreateShortcut(strDesktop & "\Shortcut Script.lnk"))。

示例

下面的示例演示创建 www.microsoft.com/china 的 URL 快捷方式。

<package>
   <job id="vbs">
      <script language="VBScript">
         set WshShell = WScript.CreateObject("WScript.Shell")
         set oUrlLink = WshShell.CreateShortcut(strDesktop & "\Microsoft Web Site.url")
         oUrlLink.TargetPath = "http://www.microsoft.com/china"
         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 = "http://www.microsoft.com/china";
         oUrlLink.Save();
      </script>
   </job>
</package>

属性

FullName 属性(WshUrlShortcut 对象) | TargetPath 属性

方法

Save 方法

请参阅

运行脚本 | CreateShortcut 方法