JScript  

GetSpecialFolder Method

[This is preliminary documentation and subject to change]

Returns the special folder object specified.

object.GetSpecialFolder(folderspec)

Arguments

object

Required. Always the name of a FileSystemObject.

folderspec

Required. The name of the special folder to be returned. Can be any of the constants shown in the Settings section.

Settings

The folderspec argument can have any of the following values:

Constant Value Description
WindowsFolder 0 The Windows folder contains files installed by the Windows operating system.
SystemFolder 1 The System folder contains libraries, fonts, and device drivers.
TemporaryFolder 2 The Temp folder is used to store temporary files. Its path is found in the TMP environment variable.

The following example illustrates the use of the GetSpecialFolder method.

var fso, tempfile;
fso = new ActiveXObject("Scripting.FileSystemObject");

function CreateTempFile()
{
   var tfolder, tfile, tname, fname, TemporaryFolder = 2;
   tfolder = fso.GetSpecialFolder(TemporaryFolder);
   tname = fso.GetTempName();
   tfile = tfolder.CreateTextFile(tname);
   return(tfile);
}
tempfile = CreateTempFile();
tempfile.writeline("Hello World");
tempfile.close();

See Also

GetAbsolutePathName Method | GetBaseName Method | GetDrive Method | GetDriveName Method | GetExtensionName Method | GetFile Method | GetFileName Method | GetFileVersion Method | GetFolder Method | GetParentFolderName Method | GetTempName MethodApplies To: FileSystemObject Object