echo off & cls echo create_shortcut start wscript -e:vbs "%~f0" Exit S End S Set WshShell=WScript.CreateObject("WScript.Shell") strDesktop=WshShell.SpecialFolders("Desktop") Set oShellLink=WshShell.CreateShortcut(strDesktop & "\QQ.link") oShellLink.TargetPath="D:\QQ\QQ.exe" oShellLink.WindowStyle=3 oShellLink.Hotkey="Ctrl+Alt+e" oShellLink.IconLocation="D:\qq\qq.exe,0" oShellLink.Description="快捷方式" oShellLink.WorkingDirectory="D:\QQ" oShellLink.Save 保存为.vbs 创建run.bat @echo "%SystemRoot%/System32/WScript.exe" ws.vbs set shortcut=WshShell.CreateShortcut("c:\a.lnk") shortcut.targetPath("d:\Office2016kms.rar") Set WshShell = WScript.CreateObject("WScript.Shell") strDesktop = WshShell.SpecialFolders("Desktop") :'特殊文件夹“桌面” '在桌面创建一个记事本快捷方式 set oShellLink = WshShell.CreateShortcut(strDesktop & "\记事本.lnk") oShellLink.TargetPath = "C:\Windows\System32\notepad.exe" : '目标 oShellLink.WindowStyle = 3 :'参数1默认窗口激活,参数3最大化激活,参数7最小化 oShellLink.Hotkey = "Ctrl+Alt+e" : '快捷键 '图标 oShellLink.IconLocation = "C:\Windows\System32\notepad.exe, 0" oShellLink.Description = "记事本快捷方式" : '备注 oShellLink.WorkingDirectory = strDesktop : '起始位置 oShellLink.Save : '创建保存快捷方式 方法一: currentpath = createobject("Scripting.FileSystemObject").GetFolder(".").Path 方法二: currentpath = createobject("Scripting.FileSystemObject").GetFile(Wscript.ScriptFullName).ParentFolder.Path 方法三: msgbox "当前文件路径是 " & wscript.ScriptFullName set ws=CreateObject("WScript.Shell") MsgBox "当前文件夹是 " & ws.CurrentDirectory 只需一个记事本,写一个.bat和一个.vbs文件,寥寥几行代码就可以在windows桌面上创建快捷方式,还可以设定图标和快捷键等。 先看VBS脚本 set WshShell=WScript.CreateObject("WScript.Shell") strDesktop=WshShell.SpecialFolders("Desktop") set oShellLink=WshShell.CreateShortcut(strDesktop & "\myShortCut.lnk") oShellLink.TargetPath="c:\mydocumentfolder\myfile.exe" oShellLink.WindowStyle=1 oShellLink.Hotkey="CTRL+SHIFT+E" oShellLink.IconLocation="c:\mydocumentfolder\icon.ico,0" oShellLink.Description="my shortcut descriptiion" oShellLink.WorkingDirectory=strDesktop oShellLink.Save 不需要其它软件开发环境,只需要打开记事本,把以上代码写入保存到后缀名为.vbs的文件中,在本例中保存为ws.vbs文件。 以上脚本具体含义: 第一行创建了一个Windows脚本宿主壳对象, 第二行获取到桌面路径, 第三行创建快捷方式lnk文件, 第四行设定快捷方式的目标路径, 第五行设定快捷方式打开窗口的风格, 第六行设定该快捷方式的快捷键, 第七行设定快捷方式的图标, 第八行设定快捷方式的描述信息, 第九行设定快捷方式的工作路径, 第十行保存快捷方式。 然后创建一个批处理文件,也只需用记事本就可以编写完成: 在这里是run.bat,其中的内容为 @echo "%SystemRoot%/System32/WScript.exe" ws.vbs 其实意思就是调用windows系统中的WScript.exe程序来处理我们上面写的那个VBS脚本。 就这么简单,你可以根据你的需要和具体情况调整各个参数,去帮你设置桌面快捷方式。