8.5.15 TempFile (create a temporary file)
- Purpose
-
Creates a temporary file.
- Syntax
TempFile (FileNameBuff, [Prefix] [, DirName])
- Arguments
-
- FileNameBuff
-
Specify a variable for storing the created temporary file name.
- Prefix
-
Specify the file prefix as a character string or as a variable that stores this value. The first three characters are valid.
This value is optional. If you omit this value, "STX" is assumed.
- DirName
-
Specify the name of the folder in which to create the temporary file, using a character string or a variable that stores this value.
This value is optional. If you omit this value, the system's temporary folder is assumed.
- Description
-
The TempFile command creates a temporary file with a name in prehexadecimal-string.TMP format in the folder specified in DirName.
pre: The character string specified in Prefix
hexadecimal-string: A hexadecimal number (1 to FFFF) created based on the system time
The command returns True on successful execution, or False if an error occurs.
This command actually creates a zero-byte file with the specified file name.
Note that created files are not automatically deleted.
- Note
-
Take care when specifying a folder in the folder set in the environment variable ProgramFiles (normally the Program Files folder on the system drive) or WinDir (normally the Windows folder on the system drive). For details, see 1.8.2 Command behavior.
- Example
' Create a temporary file name and copy "MODEM.INF" to ' the created temporary file. Dim bkupFileName, outDir1 outDir1 = _TEMP_ ' Create a temporary file name with the prefix "BUP". TempFile (bkupFileName, "BUP", outDir1) Copy (outDir1+"MODEM.INF", bkupFileName)
- JP1/Script version
-
Supported from JP1/Script 01-00.