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

vbs创建快捷方式

2013-05-24 10:24 866 查看
Dim FileName
FileName = "Mffff" '字符串
Set shortcut = CreateObject("WScript.Shell").CreateShortcut(CreateObject("WScript.Shell").SpecialFolders("Desktop") & + "\" + FileName + ".lnk")
shortcut.Description = "My shortcut" '属性描述
shortcut.TargetPath = "H:\000"	‘快捷方式目标对象的位置
shortcut.Arguments = "/Arguments:Shortcut" '参数说明
shortcut.Save	'对象方法  保存快捷方式
set WshShell    = Wscript.CreateObject("Wscript.Shell")
strDesktop  = WshShell.SpecialFolders("Desktop")  '在桌面创建快捷方式

set oShellLink  = WshShell.CreateShortcut(strDesktop & "\\QQ.lnk")
'创建一个快捷方式对象,其在桌面上显示的名字为"QQ"
oShellLink.TargetPath  = "D:\Program Files\Tencent\QQ\qq.exe"
'设置快捷方式的执行路径
oShellLink.WindowStyle = 3         '运行方式
oShellLink.Hotkey      = "Ctrl+Alt+e"  '设置快捷方式的快捷键
oShellLink.IconLocation= "D:\Program Files\Tencent\QQ\qq.exe,0" '设置快捷方式的图标
oShellLink.Description = "IDEasm v1.0"  '设置快捷方式的描述
oShellLink.WorkingDirectory = "D:\"          '起始位置
oShellLink.Save
--------------------------------------------------------------------------------------

(1)设置快捷方式图标时,有以下方式:

"D:\Program Files\Tencent\QQ\qq.exe,0"  '使用程序自身图标
"C:\windows\system32\shell32.dll   ,1"  '使用系统自带图标
"D:\My projects\ICO\book.ico"           '使用自定义图标

注:以上路径中不能出现中文字符,否则图标可能无法显示。

(2)运行方式:

参数1默认窗口激活,参数3最大化显示,参数7最小化显示
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: