将文件夹的快捷方式创建到桌面上的批处理怎么写

我有一个目录是“D:\通讯录”,想用批处理创建一个快捷方式到桌面上去,就是和用“鼠标右击-发送到-桌面快捷方式”的操作一样的效果。这个批处理应该怎么写?

可以用URL文件方法

echo [InternetShortcut]>"%userprofile%\桌面\快捷方式.url"
echo URL=file:///D:\通讯录>>"%userprofile%\桌面\快捷方式.url"

用VBS方法
Set fso=CreateObject("Scripting.FileSystemObject")
Set WshShell=WScript.CreateObject("WScript.Shell")
Set Shortcut=WshShell.CreateShortCut("快捷方式名.lnk")
Shortcut.TargetPath=("文件路径")
Shortcut.Save
温馨提示:答案为网友推荐,仅供参考
第1个回答  2012-03-07

建议用vbs、autoit脚本来做

如果非要批处理,以前autoit写了个让批处理调用的工具,想要请联系

第2个回答  2020-04-15
@echo
off
rem
创建文件夹的快捷方式
>"%userprofile%\桌面\test.url"
echo
[InternetShortcut]
>>"%userprofile%\桌面\test.url"
echo
URL="D:\通讯录"
>>"%userprofile%\桌面\test.url"
echo
IconIndex=4
>>"%userprofile%\桌面\test.url"
echo
IconFile=%windir%\system32\shell32.dll
相似回答