把如下代码内容保存为shortcut.vbs,然后创建快捷方式到sendto目录下(C:\Documents and Settings\username\SendTo),改个自己想要的名字,如“创建快捷方式到我的工作目录”,即可实现创建快捷方式了,而且支持多文件,只需要把脚本中第4行中的的strFolder改成自己需要的值:
复制代码 代码如下:
Set unNamedArguments = WScript.Arguments.UnNamed set WshShell = WScript.CreateObject("WScript.Shell") Set objFSO = CreateObject("Scripting.FileSystemObject") strFolder = "d:\temp\" '后面要有符号"\" 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