VBScript: ショートカットの作成
普通のファイルへのショートカットであれば、以下の方法で作成できる。
Option Explicit
Dim wsh: Set wsh = CreateObject("WScript.Shell")
Dim fso: Set fso = CreateObject("Scripting.FileSystemObject")
Dim desktop_path: desktop_path = wsh.SpecialFolders("Desktop")
Dim shortcut_path: shortcut_path = desktop_path & "\Shortcut to notepad.lnk"
Dim target_path: target_path = "%windir%\notepad.exe"
Dim shortcut
If fso.FileExists(shortcut_path) Then
WScript.Echo "Shortcut already exists."
Else
Set shortcut = wsh.CreateShortcut(shortcut_path)
shortcut.TargetPath = target_path
shortcut.Save
Set shortcut = Nothing
End If
Set wsh = Nothing
Set fso = Nothing
参考:
http://visualbasic.about.com/od/quicktips/qt/createshortcut.htm
0 件のコメント:
コメントを投稿