纯脚本创建桌面快捷方式

最近在看关于wmi的书,深深感觉wscript的危害之大。这里将书上提到的一些应用的例程放上来,大家鉴赏一下,可

不要拿来做坏事哟。新建一个vbs脚本文件。键入下面的内容

call testwmi()

function testwmi()
dim objShell

set objShell = WScript.CreateObject("WScript.Shell")
dim strDesktop

strDesktop = objShell.SpecialFolders("Desktop")


'now, we can create shortcuts on the desktop
'let's do Internet Explorer

dim objShortcut

set objShortcut= objShell.CreateShortcut(strDesktop & "\IE.lnk")

 

     objShortcut.TargetPath = "iexplore.exe"

     objShortcut.WindowStyle = 1

     objShortcut.Hotkey = "CTRL+SHIFT+I"

     objShortcut.Description = "Launch Internet Explorer"

     objShortcut.WorkingDirectory = strDesktop

     objShortcut.Save

'let's create a link to my home page

dim objURL
set objURL = objShell.CreateShortcut(strDesktop & "\webtrados.url")
objURL.TargetPath = "http://www.iwebtrados.com.cn/"
objURL.Save
end function

你可能感兴趣的:(脚本)