次の方法で共有


WshUrlShortcut オブジェクト

Cc364464.wsWshUrlShortcutObject(ja-jp,MSDN.10).gif

URL ショートカットへのオブジェクト参照を作成します。

解説

WshUrlShortcut オブジェクトは WshShell オブジェクトの子オブジェクトです。WshUrlShortcut オブジェクトを作成するには、WshShell のメソッドである CreateShortcut を使用します (例 : WshShell.CreateShortcut(strDesktop & "\ショートカット スクリプト.lnk"))。

使用例

次のコードは、www.microsoft.com への 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 = "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>

プロパティ

FullName プロパティ (WshUrlShortcut オブジェクト) | TargetPath プロパティ

メソッド

Save メソッド

参照

スクリプトを実行する | CreateShortcut メソッド