映射特殊文件夾(如“我的文檔”桌面文件夾)需要用到 Shell 對(duì)象。下面的腳本將演示如何使用 Shell 對(duì)象在桌面上創(chuàng)建文件夾的快捷方式。
// 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