Getspecialfolder Method
Returns the specified special folder.
Object.Getspecialfolder(Folderspec)
Parameters
Object
Required. The name of FileSystemObject.
Folderspec
Required. The name of the special folder to return. It can be any constant listed in the "Settings" section.
Set
Folderspec can have the following values:
| Constant |
Value |
Description |
| Windowsfolder |
0 |
Windows folder, which contains files installed in the Windows operating system. |
| Systemfolder |
1 |
System folder, including library, Font, and Device DriverProgramFile. |
| Temporaryfolder |
2 |
Temp folder, used to save temporary files. You can find the path of the folder in the TMP environment variable. |
Description
The following example illustrates how to useGetspecialfolderMethod:
dim FSO, tempfileset FSO = Createobject ("scripting. fileSystemObject ") function createtempfile dim tfolder, tname, tfile const temporaryfolder = 2 set tfolder = FSO. getspecialfolder ( temporaryfolder ) tname = FSO. gettempname set tfile = tfolder. createtextfile (tname) set createtempfile = tfileend functionset tempfile = createtempfiletempfile. writeline " Hello World " tempfile. close