建快捷方式注意不要被防火墙阻止了
@echo off&color f1
set lnk="%USERPROFILE%\桌面\工程预算.lnk"
set fn="%~dp0工程管理.exe"
set ico="%~dp0GCYS.ICO"
echo Dim WshShell,Shortcut>tmpe.vbs
echo Dim path,fso>>temp.vbs
echo path=%fn%>>temp.vbs
echo Set fso=CreateObject("Scripting.FileSystemObject")>>temp.vbs
echo Set WshShell=WScript.CreateObject("WScript.Shell")>>temp.vbs
echo Set Shortcut=WshShell.CreateShortCut(%lnk%)>>temp.vbs
echo Shortcut.IconLocation=%ico%>>temp.vbs
echo Shortcut.TargetPath=path>>temp.vbs
echo Shortcut.Save>>temp.vbs
temp.vbs
del temp.vbs
用批处理也是间接通过VBS实现,所以我直接给出VBS代码
以下在桌面生成百度的快捷方式
---------------------------------------------
set ws = createobject("wscript.shell")
strDesktop = ws.SpecialFolders("Desktop")
set wind = ws.createshortcut(strDesktop & "\baidu.lnk")
wind.targetpath = "%ProgramFiles%\Internet Explorer\IEXPLORE.EXE"
wind.workingdirectory = "%ProgramFiles%\Internet Explorer"
wind.Arguments=""
wind.save
类似的,楼主需要的就是:
set ws = createobject("wscript.shell")
strDesktop = ws.SpecialFolders("Desktop")
set wind = ws.createshortcut(strDesktop & "\1asf.lnk")
wind.targetpath = "C:\Program Files\Windows Media Player\wmplayer.exe"
wind.workingdirectory = "C:\Program Files\Windows Media Player"
wind.Arguments=""
wind.save
-------------------------------------------------
要改生成的快捷方式名称,可以对上面代码中的lasf.lnk进行修改,如
set wind = ws.createshortcut(strDesktop & "\1asf.lnk")
改成
set wind = ws.createshortcut(strDesktop & "\new.lnk")
---------------------------------------------------
如要改成批处理的,如下(我这里360会干涉,取消阻止即可)
@echo off
more %0 +5>yst.vbs
yst.vbs
del yst.vbs
exit
set ws = createobject("wscript.shell")
strDesktop = ws.SpecialFolders("Desktop")
set wind = ws.createshortcut(strDesktop & "\1asf.lnk")
wind.targetpath = "C:\Program Files\Windows Media Player\wmplayer.exe"
wind.workingdirectory = "C:\Program Files\Windows Media Player"
wind.Arguments=""
wind.save
学习一下,楼上两位...