O'Reilly logo

VBScript in a Nutshell, 2nd Edition by Ron Petrusha, Matt Childs, Paul Lomax

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

FileSystemObject.GetSpecialFolder Method

Syntax

                  oFileSysObj
                  .GetSpecialFolder(SpecialFolder)
oFileSysObj

Use: Required

Data Type: FileSystemObject object

A FileSystemObject object.

SpecialFolder

Use: 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

SystemFolder

1

The Windows system folder (/windows/system or /windows/system32)

TemporaryFolder

2

The folder that stores temporary files (../windows/temp)

WindowsFolder

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 SpecialFolderConst enumeration 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required