This documentation is archived and is not being maintained.

Path.GetTempPath Method

Returns the path of the current system's temporary folder.

[Visual Basic]
Public Shared Function GetTempPath() As String
[C#]
public static string GetTempPath();
[C++]
public: static String* GetTempPath();
[JScript]
public static function GetTempPath() : String;

Return Value

A String containing the path information of a temporary directory.

Exceptions

Exception Type Condition
SecurityException The caller does not have the required permissions.

Remarks

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

Requirements

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

.NET Framework Security: 

See Also

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

Show: