映射特殊文件夹(如“我的文档”桌面文件夹)需要用到 Shell 对象。下面的脚本将演示如何使用 Shell 对象在桌面上创建文件夹的快捷方式。
// JScript。 var Shell,DesktopPath,URL; Shell = new ActiveXObject("WScript.Shell"); DesktopPath = Shell.SpecialFolders("Desktop"); URL = Shell.CreateShortcut(DesktopPath + "\\MSDN Scripting.url"); URL.TargetPath = "http://www.microsoft.com/china/scripting/"; URL.Save(); ' VBScript。 Dim Shell,DesktopPath,URL Set Shell = CreateObject("WScript.Shell") DesktopPath = Shell.SpecialFolders("Desktop") Set URL = Shell.CreateShortcut(DesktopPath & "\MSDN Scripting.URL") URL.TargetPath = "http://www.microsoft.com/china/scripting/" URL.Save