TempDir Function

Purpose

Returns the path of the directory designated for temporary files.

Syntax

$ = TempDir[$]

Description

Returns a string specifying the temporary file path. The returned string ends with a backslash, for example, C:\TEMP\.

The TempDir function checks for the existence of environment variables in the following order and uses the first path found:

The path specified by the TMP environment variable (%TMP%).

The path specified by the TEMP environment variable (%TEMP%).

The path specified by the USERPROFILE environment variable (%USERPROFILE%).

The Windows directory.

Note that the function does not verify that the path exists.

Windows Me/98/95:  If TMP and TEMP are not set to a valid path, TempDir uses the current directory.

Example

Message TempDir

Remarks

The system directories have different names on different machines and OSs. For often used directories GFA-BASIC 32 provides WinDir, SysDir, and TempDir to return the specific directories.

See Also

SysDir, WinDir, TempFileName, scSpecialDir

{Created by Sjouke Hamstra; Last updated: 24/10/2014 by James Gaite}