Name
FileSystemObject.GetSpecialFolder Method
Syntax
oFileSysObj.GetSpecialFolder(SpecialFolder)
oFileSysObjUse: Required
Data Type: FileSystemObject object
A FileSystemObject object.
SpecialFolderUse: Required
Data Type: Special folder constant
A value specifying one of three special system folders.
Return Value
A Folder object.
Description
Returns a reference to a Folder object of one of the three special system folders: System, Temporary, and Windows.
Rules at a Glance
SpecialFolder can be one of the
following special folder constants:
Constant | Value | Description |
| 1 | The Windows system folder (/windows/system or /windows/system32) |
| 2 | The folder that stores temporary files (../windows/temp) |
| 0 | The root folder of the Windows system folder tree (/windows or /winnt) |
Programming Tips and Gotchas
As the previous table shows, the Scripting Runtime type library defines constants of the
SpecialFolderConstenumeration that can be used in place of their numeric equivalents. You can use them in your scripts in either of two ways. You can define the constants yourself by adding the following code to your script:Const WindowsFolder = 0 Const SystemFolder = 1 Const TemporaryFolder = 2
You can also include a METADATA tag in an ASP global.asa file or include the following line in a Windows Script Host (.wsf ) file in order to access the constants from the Scripting Runtime type library:
<reference GUID="{420B2830-E718-11CF-893D-00A0C9054228}" />Prior to the development of the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access