Option Explicit
Dim wshShell, Shortcut
Dim strDir, strName
strName = "命令提示符"
Set wshShell = WSH.CreateObject("WScript.Shell")
strDir = wshShell.SpecialFolders("Desktop")
Set Shortcut = wshShell.CreateShortcut(strDir &_
"\" & strName & ".lnk")
Shortcut.TargetPath = "C:\Windows\System32\cmd.exe"
Shortcut.WindowStyle = 1
Shortcut.Hotkey = "CTRL+ALT+U"
Shortcut.Description = "这是命令提示符程序描述"
Shortcut.WorkingDirectory = strDir
Shortcut.Save
Set Shortcut = Nothing
Set wshShell = Nothing
以上代码就是利用了WScript.Shell的另外一个功能,那就是获得特殊目录路径SpecialFolders,我们这里尝试获取的是桌面的路径位置,然后将其赋值给strDir,余下就是你懂的。
以上来自王晔