Returns the path of the current user's temporary folder.
public:
static System::String ^ GetTempPath();
public static string GetTempPath();
static member GetTempPath : unit -> string
Public Shared Function GetTempPath () As String
Returns
The path to the temporary folder, ending with a DirectorySeparatorChar.
ExceptionsThe caller does not have the required permissions.
ExamplesThe following code shows how to call the GetTempPath method.
Dim result As String = Path.GetTempPath()
Console.WriteLine(result)
string result = Path.GetTempPath();
Console.WriteLine(result);
This example produces output similar to the following.
C:\Users\UserName\AppData\Local\Temp\
Remarks
The method does not verify that the path exists or test to see if the current process can access the path.
If the current Windows version exposes the GetTempPath2
Win32 API, this method invokes that API and returns the resolved path. For more information on how this resolution is performed, including how to control the return value through the use of environment variables, see the Remarks section of the GetTempPath2 documentation. The GetTempPath2 API might not be available on all versions of Windows.
On Windows versions that don't expose GetTempPath2, this method instead invokes the GetTempPath
Win32 API and returns the resolved path. For more information on how this resolution is performed, including how to control the return value through the use of environment variables, see the Remarks section of the GetTempPath documentation.
If the TMPDIR
environment variable has been set, this method returns the value specified by that environment variable.
Otherwise, this method returns /tmp/
.
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide. In this articleWas this page helpful?
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4