Skip to content

Instantly share code, notes, and snippets.

@narcotics726
Created March 22, 2013 17:48
Show Gist options
  • Save narcotics726/5223299 to your computer and use it in GitHub Desktop.
Save narcotics726/5223299 to your computer and use it in GitHub Desktop.
Right click and "Send(ShortCut)To:DestPath" 发送快捷方式到:
Set unNamedArguments = WScript.Arguments.UnNamed
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
strFolder="X:/Path" 'your dest path
for count=0 to wscript.arguments.count-1 Step 1
filename = unNamedArguments.Item(count)
Set objFile = objFSO.GetFile(filename)
Set oShellLink = WshShell.CreateShortcut(strFolder&objFSO.GetBaseName(filename)&".lnk")
oShellLink.TargetPath=filename
oShellLink.WindowStyle=1
oShellLink.WorkingDirectory=objFSO.GetParentFolderName(filename)
oShellLink.Save
NEXT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment