您的位置:首页 > 编程语言 > VB

批处理(.BAT) VBS 创建快捷方式

2013-10-25 15:14 519 查看
批处理(.BAT)创建快捷方式
-----------------------------------------------------------------
set path=C:\windows\system32\cmd.exe
echo [InternetShortcut] >>cmd.url
echo URL="%path%" >>cmd.url
echo IconIndex=29 >>cmd.url
echo IconFile=C:\windows\system32\shell32.dll >>cmd.url
set path=C:\windows\system32\mstsc.exe
echo [InternetShortcut] >>mstsc.url
echo URL="%path%" >>mstsc.url
echo IconIndex=29 >>mstsc.url
echo IconFile=C:\windows\system32\shell32.dll >>mstsc.url
del %0%
 
VBS 创建快捷方式
-----------------------------------------------------------------
cmd = "c:\windows\system32\cmd.exe"
mstsc = "c:\windows\system32\mstsc.exe"
Set objShell = CreateObject("Wscript.Shell")
Set objShellLink = objShell.CreateShortcut("cmd.lnk")
objShellLink.TargetPath = cmd
objShellLink.Save
Set objShellLink = objShell.CreateShortcut("mstsc.lnk")
objShellLink.TargetPath = mstsc
objShellLink.Save
Set fso = CreateObject("Scripting.FileSystemObject")
f = fso.DeleteFile(WScript.ScriptName)

变通的方法,这个快捷方式和用右键中的“发送桌面快捷方式”建立的是不一样的。如果想建立那种的话可以考虑用 VBS。
iconfile:指定了快捷方式使用的图标文件。
iconindex:指定了快捷方式使用的图标文件中的第几个图标。
url:指定了快捷方式指向的可执行文件。 

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: