Skip to content

Instantly share code, notes, and snippets.

@eggist77
Last active February 24, 2019 00:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eggist77/9116f25f0c34894aa32d8d1c81c199d4 to your computer and use it in GitHub Desktop.
Save eggist77/9116f25f0c34894aa32d8d1c81c199d4 to your computer and use it in GitHub Desktop.
[VBS]ショートカットを作成する
Option Explicit
'variable declaration
Dim crDir, f, line, ary, fName
Dim fso, wsh
Set fso = CreateObject("Scripting.FileSystemObject")
Set wsh = CreateObject("WScript.Shell")
crDir = fso.getParentFolderName(WScript.ScriptFullName)
Set f = fso.OpenTextFile(crDir & "\sclist.txt", 1)
Do Until f.AtEndOfStream
line = f.ReadLine
ary = Split(line, ",")
Call shortCutAdd(ary(0),ary(1))
Loop
f.Close
Sub shortCutAdd(scname,exePath)
Dim shortCutFile
fName = crDir & "\" & scname & ".lnk"
Set shortCutFile = wsh.CreateShortcut(fName)
shortCutFile.TargetPath = exePath
shortCutFile.Save
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment