Microsoft® Windows® 2000 Scripting Guide
« Previous | Next »
Special folders are folders that are or at least potentially can be present on all Windows computers; these include the My Documents, Fonts, and Start Menu folders. There are two types of special folders: those that map to standard directories and those that do not. The Favorites folder, for example, maps to a standard directory; the My Computer folder does not.
The WScript SpecialFolders collection contains the full path to each of the special folders that map to a standard directory. Table 3.11 lists the identifiers and the contents of each of the special folders in the SpecialFolders collection.
Table 3.11 Special Folders Identifier
Identifier | Folder Contents |
---|---|
AllUsersDesktop | Shortcuts that appear on the desktop for all users |
AllUsersStartMenu | Shortcuts that appear on the Start menu for all users |
AllUsersPrograms | Shortcuts that appear on the Programs menu for all users |
AllUsersStartup | Shortcuts to programs that are run on startup for all users |
Desktop | Shortcuts that appear on the desktop for the current user |
Favorites | Shortcuts saved as favorites by the current user |
Fonts | Fonts installed on the system |
MyDocuments | Current user s documents |
NetHood | Objects that appear in Network Neighborhood |
PrintHood | Printer links |
Recent | Shortcuts to current user s recently opened documents |
SendTo | Shortcuts to applications that show up as possible send-to targets when a user right-clicks on a file in Windows Explorer |
StartMenu | Shortcuts that appear in the current user s start menu |
Startup | Shortcuts to applications that run automatically when the current user logs on to the system |
Templates | Application template files specific to the current user |
To determine the location of any folder, retrieve the value of the SpecialFolders.Item property, specifying the name of one of the identifiers shown in Table 3.11.
Note
The script in Listing 3.20 determines the location of the Fonts special folder. The script echoes the location of the Fonts folder.
Listing 3.20 Determining the Location of the Fonts Folder
|
|
When you install an application, that application often associates itself with a particular file type. For example, when you install the Microsoft® FrontPage® Web site creation and management tool, FrontPage associates itself with all .htm files. If you right-click on a .htm file and click Edit, the file will open in FrontPage.
Of course, there might be times when you simply want to view the .htm file in Notepad. Recognizing this fact, Windows includes a special folder named SendTo. The SendTo option presents a menu of applications or locations to which you can send the selected file. You can add to the options available in the SendTo menu by adding shortcuts to the SendTo special folder. The next time you want to open an .htm file (or any file) in Notepad, you can simply right-click the file, select SendTo, and then click Notepad.
The script in Listing 3.21 creates a shortcut to the Notepad application in the SendTo special folder, thus adding Notepad to the SendTo menu.
Listing 3.21 Adding the Notepad Application to the SendTo Menu
|
|
Send us your feedback | « Previous | Next » |