创建快捷方式的脚本

来源:百度文库 编辑:神马文学网 时间:2024/04/28 06:22:53
cd.>tmp.vbs
for /f "usebackq skip=4 tokens=*" %%a in (%0) do @echo %%a>>tmp.vbs
tmp.vbs&del tmp.vbs /q
goto :eof

Set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop") :'特殊文件夹“桌面”

Rem 在桌面创建一个记事本快捷方式
set oShellLink = WshShell.CreateShortcut(strDesktop & "\记事本.lnk")
oShellLink.TargetPath = "notepad.exe" : '目标
oShellLink.WindowStyle = 3 :'参数1默认窗口激活,参数3最大化激活,参数7最小化
oShellLink.Hotkey = "Ctrl+Alt+e" : '快捷键
oShellLink.IconLocation = "notepad.exe, 0" : '图标
oShellLink.Description = "记事本快捷方式" : '备注
oShellLink.WorkingDirectory = strDesktop : '起始位置
oShellLink.Save : '创建保存快捷方式

Rem 在桌面创建一个“微软中国”的Url快捷方式
set oUrlLink = WshShell.CreateShortcut(strDesktop & "\微软中国.url")
oUrlLink.TargetPath = "http://www.microsoft.com/china"
oUrlLink.Save