FileSystem.GetTempFileName Method

Definition

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

C#
public static string GetTempFileName();

Returns

String containing the full path of the temporary file.

Examples

This example creates a temp file and returns its path.

VB
MsgBox("The file is located at " &
My.Computer.FileSystem.GetTempFileName)

Remarks

This method can be used to create a temporary file.

Applies to

Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1