Kilhoffer
Kilhoffer

Reputation: 32906

In a .Net winforms application, how do I obtain the path the current user's temp folder?

Seems so basic, I can't believe I don't know this! I just need a scratch folder to dump some temporary files to. I don't care if it gets wiped out between usages or not, and I don't think I should have to go through the hassle of creating one and maintaining it myself from within my application. Is that too much to ask?

Upvotes: 4

Views: 2083

Answers (3)

Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) or Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)

Upvotes: 5

Adam Wright
Adam Wright

Reputation: 49376

Use System.IO.Path.GetTempPath().

Upvotes: 16

Teme64
Teme64

Reputation: 31

This is for VB.NET

My.Computer.FileSystem.SpecialDirectories.Temp

not sure if there's similar in C#

Upvotes: 3

Related Questions