Export (0) Print
Expand All

Path.GetTempFileName Method

Returns a uniquely named zero-byte temporary file on disk and returns the full path to that file.

[Visual Basic]
Public Shared Function GetTempFileName() As String
public static string GetTempFileName();
public: static String* GetTempFileName();
public static function GetTempFileName() : String;

Return Value

A String containing the name of the temporary file.


The following table lists examples of other typical or related I/O tasks.

To do this... See the example in this topic...
Create a text file. Writing Text to a File
Write to a text file. Writing Text to a File
Read from a text file. Reading Text from a File
Retrieve a file extension. GetExtension
Retrieve the fully qualified path of a file. GetFullPath
Retrieve the file name and extension from a path. GetFileName
Retrieve only the file name from a path. GetFileNameWithoutExtension
Retrieve only the directory name from a path. GetDirectoryName
Change the extension of a file. ChangeExtension
Determine if a directory exists. Exists
Determine if a file exists. Exists


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

Path Class | Path Members | System.IO Namespace | Working with I/O | Reading Text from a File | Writing Text to a File

© 2014 Microsoft