WshShell.SpecialFolders SpecialFolders 属性提供 WshSpecialFolders 对象以便访问 Windows 的 shell 文件夹,例如桌面文件夹、开始菜单文件夹和个人文档文件夹。
语法 WshShell.SpecialFolders = objWshSpecialFolders
示例 '' This code fragment shows how to access the desktop folder Set WshShell = Wscript.CreateObject("Wscript.Shell") MsgBox "Your desktop is " WshShell.SpecialFolders("Desktop") 请参阅 WshSpecialFolders 对象
Windows 95 和 Windows NT 4.0 操作系统提供下列指定文件夹: AllUsersDesktop AllUsersStartMenu
AllUsersPrograms
AllUsersStartup
Desktop
Favorites
Fonts
MyDocuments
NetHood
PrintHood
Programs
Recent
SendTo
StartMenu
Startup
Templates
示例 '' This fragment returns the full path for the Windows Desktop folder Set WshShell = Wscript.CreateObject("Wscript.Shell") StrMyDesktop = WshShell.SpecialFolders("Desktop")
'' List all special folders For Each strFolder In WshShell.SpecialFolders MsgBox strFolder Next
示例 '' This code fragment creates a shortcut '' to the currently executing script Set WshShell = Wscript.CreateObject("Wscript.Shell") Set oShellLink = WshShell.CreateShortcut("Current Script.lnk") oShellLink.TargetPath = Wscript.ScriptFullName oShellLink.Save Set oUrlLink = WshShell.CreateShortcut("Microsoft Web Site.URL") oUrlLink.TargetPath = "http://www.microsoft.com" oUrlLink.Save