Auto-Generate a File Name in VBScript


The FileSystemObject provides a GetTempName method that returns a temporary file name. The following is the short example, in VBScript on Windows Scripting Host.

1
2
3
4
5
6
7
8
' Auto-Generate a File Name
 
Set objFSO = CreateObject("Scripting.FileSystemObject")
 
For i = 1 to 10
    strTempFile = objFSO.GetTempName
    Wscript.Echo strTempFile
Next
' Auto-Generate a File Name

Set objFSO = CreateObject("Scripting.FileSystemObject")

For i = 1 to 10
    strTempFile = objFSO.GetTempName
    Wscript.Echo strTempFile
Next

–EOF (The Ultimate Computing & Technology Blog) —

GD Star Rating
loading...
91 words
Last Post: Bubble Sort in VBScript
Next Post: Using XMLHTTP in VBScript

The Permanent URL is: Auto-Generate a File Name in VBScript

Leave a Reply