赞
踩
Set WshShell = WScript.CreateObject("WScript.Shell") Rem 特殊文件夹桌面 strDesktop = WshShell.SpecialFolders("Desktop") Rem ShortCutName表示桌面图标名称 set oShellLink = WshShell.CreateShortcut(strDesktop & "\ShortCutName.lnk") Rem TargetProgramPath表示目标程序所在路径 oShellLink.TargetPath = "TargetProgramPath" Rem 参数1默认窗口激活,参数3最大化激活,参数7最小化 oShellLink.WindowStyle = 3 Rem ShortcutKey表示快捷键,示例:Ctrl+Alt+e oShellLink.Hotkey = "ShortcutKey" Rem IconLocation表示桌面快捷方式图标路径 oShellLink.IconLocation = “IconLocation” Rem Remark表示桌面快捷方式备注 oShellLink.Description = "Remark" Rem WorkingDirectory表示起始位置 oShellLink.WorkingDirectory = “WorkingDirectory” Rem 保存快捷方式 oShellLink.Save
Set WshShell = WScript.CreateObject("WScript.Shell")
Rem 特殊文件夹桌面
strDesktop = WshShell.SpecialFolders("Desktop")
Rem ShortCutName表示桌面图标名称
set oUrlLink = WshShell.CreateShortcut(strDesktop & "\ShortCutName.url")
Rem TargetProgramPath表示目标程序所在路径,示例:http://www.baidu.com/
oUrlLink.TargetPath = "TargetProgramPath"
Rem 保存快捷方式
oUrlLink.Save
:: 定义创建桌面快捷 :: -- %~1: 应用程序所在路径 :: -- %~2: 桌面快捷方式名称 :: -- %~3: 快捷方式图标目录 :create_desktop_shortcut IF NOT DEFINED WorkDir call:GetWorkDir "%~1" (ECHO Set WshShell=CreateObject("WScript.Shell"^) ECHO strDesKtop=WshShell.SpecialFolders("DesKtop"^) ECHO Set oShellLink=WshShell.CreateShortcut(strDesKtop^&"\%~2.lnk"^) ECHO oShellLink.TargetPath="%~1" ECHO oShellLink.WorkingDirectory="" ECHO oShellLink.IconLocation="%~3" ECHO oShellLink.WindowStyle=1 ECHO oShellLink.Description="" ECHO oShellLink.Save)>makelnk.vbs ECHO 桌面快捷方式创建成功! makelnk.vbs DEL /f /q makelnk.vbs GOTO:EOF
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。