如果我想创建两个应用程序的快捷方式,但是我不想执行两次,能否把他们写在一个命令下执行,应该怎么写?
1个回答
展开全部
把代码执行两次呗,复制一下加在后面,只要两次生成的快捷方式名字不同就行了,不然第二个会把第一个覆盖掉
echo ThePath = "目标程序1路径">aaa.vbs
echo lnkname = "快捷方式名字1.lnk">>aaa.vbs
echo WS = "Wscript.Shell">>aaa.vbs
echo Set Shell = CreateObject(WS)>>aaa.vbs
echo Set Link = Shell.CreateShortcut(lnkname)>>aaa.vbs
echo Link.TargetPath = ThePath>>aaa.vbs
echo Link.Save>>aaa.vbs
echo Set fso = CreateObject("Scripting.FileSystemObject")>>aaa.vbs
echo f = fso.DeleteFile(WScript.ScriptName)>>aaa.vbs
start /wait aaa.vbs
del aaa.vbs
echo ThePath = "目标程序2路径">aaa.vbs
echo lnkname = "快捷方式名字2.lnk">>aaa.vbs
echo WS = "Wscript.Shell">>aaa.vbs
echo Set Shell = CreateObject(WS)>>aaa.vbs
echo Set Link = Shell.CreateShortcut(lnkname)>>aaa.vbs
echo Link.TargetPath = ThePath>>aaa.vbs
echo Link.Save>>aaa.vbs
echo Set fso = CreateObject("Scripting.FileSystemObject")>>aaa.vbs
echo f = fso.DeleteFile(WScript.ScriptName)>>aaa.vbs
start /wait aaa.vbs
del aaa.vbs
echo ThePath = "目标程序1路径">aaa.vbs
echo lnkname = "快捷方式名字1.lnk">>aaa.vbs
echo WS = "Wscript.Shell">>aaa.vbs
echo Set Shell = CreateObject(WS)>>aaa.vbs
echo Set Link = Shell.CreateShortcut(lnkname)>>aaa.vbs
echo Link.TargetPath = ThePath>>aaa.vbs
echo Link.Save>>aaa.vbs
echo Set fso = CreateObject("Scripting.FileSystemObject")>>aaa.vbs
echo f = fso.DeleteFile(WScript.ScriptName)>>aaa.vbs
start /wait aaa.vbs
del aaa.vbs
echo ThePath = "目标程序2路径">aaa.vbs
echo lnkname = "快捷方式名字2.lnk">>aaa.vbs
echo WS = "Wscript.Shell">>aaa.vbs
echo Set Shell = CreateObject(WS)>>aaa.vbs
echo Set Link = Shell.CreateShortcut(lnkname)>>aaa.vbs
echo Link.TargetPath = ThePath>>aaa.vbs
echo Link.Save>>aaa.vbs
echo Set fso = CreateObject("Scripting.FileSystemObject")>>aaa.vbs
echo f = fso.DeleteFile(WScript.ScriptName)>>aaa.vbs
start /wait aaa.vbs
del aaa.vbs
追问
谢谢啦,不过我有一点疑问,.bat文件和.cmd文件有什么区别呢。暂时没有发现两者的区别,一样可以运行,效果也是一样的。
追答
应该是解释器不同。不过这个我也不清楚,我是用的cmd。反正都是用的dos指令,也就没管那么多了。
来自:求助得到的回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询