Path.GetTempPath Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.
Exceptions
The caller does not have the required permissions.
Examples
The 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.
Applies to
See also
משוב
https://aka.ms/ContentUserFeedback.
בקרוב: במהלך 2024, נפתור בעיות GitHub כמנגנון המשוב לתוכן ונחליף אותו במערכת משוב חדשה. לקבלת מידע נוסף, ראה:שלח והצג משוב עבור