Microsoft® JScript® GetTempName Method |
Scripting Run-Time Reference Version 3 |
Returns a randomly generated temporary file or folder name that is useful for performing operations that require a temporary file or folder.
object.GetTempName ( );The optional object is always the name of a FileSystemObject.
The GetTempName method does not create a file. It provides only a temporary file name that can be used with CreateTextFile to create a file.The following example illustrates the use of the GetTempName 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();