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