Skip to content

Instantly share code, notes, and snippets.

@Ancientwood
Created October 12, 2021 04:02
Show Gist options
  • Save Ancientwood/ddab0e8e35a6855d674b4bd7c92245ff to your computer and use it in GitHub Desktop.
Save Ancientwood/ddab0e8e35a6855d674b4bd7c92245ff to your computer and use it in GitHub Desktop.
Const strDestination = "C:\Users\user\Desktop\shortcut"
Set objArgs = WScript.Arguments
Set WshShell = WScript.CreateObject("WScript.Shell")
For i = 0 to objArgs.Count - 1 '' Loop through all arguments.
strShortCut = strDestination & "\" & GetAName(objArgs(i)) & ".lnk"
set oShellLink = WshShell.CreateShortcut(strShortCut)
oShellLink.TargetPath = objArgs(i)
oShellLink.WindowStyle = 1
oShellLink.WorkingDirectory = Left(objArgs(i), InStrRev(objArgs(i), "\"))
oShellLink.Save
Next
Function GetAName(DriveSpec)
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
GetAName = fso.GetBaseName(DriveSpec)
End Function
''end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment