这里说的快捷方式严格上来说并不是快捷方式,而是指符号链接。关于两者的区别以前写过一篇博文,详情可以看这里。
使用批处理可以方便地建立符号链接,比如:
MKLINK %userprofile%\Desktop\CTS6.exe "%userprofile%\Documents\Euro Truck Simulator 2\CTS6.exe"
注意:
- 符号链接的类型一定要和文件的类型一样,不然会提示Access Is Denied。
- 目标文件的路径,一定要用引号引起来。
- 目标文件一定要用绝对路径,不要用相对路径(可以用%cd%来表示当前路径)。
借用VBS文件来创建快捷方式:
@echo off
set Program=文件路径和
set LnkName=快捷方式名
set WorkDir=
set Desc=描述
if not defined WorkDir call:GetWorkDir "%Program%"
(echo Set WshShell=CreateObject("WScript.Shell"^)
echo strDesKtop=WshShell.SpecialFolders("DesKtop"^)
echo Set oShellLink=WshShell.CreateShortcut(strDesKtop^&"\%LnkName%.lnk"^)
echo oShellLink.TargetP