Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

.net

winforms

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?

like image 441
Kilhoffer Avatar asked Nov 29 '22 12:11

Kilhoffer


2 Answers

Use System.IO.Path.GetTempPath().

like image 197
Adam Wright Avatar answered Dec 27 '22 01:12

Adam Wright


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

like image 31
Eduardo Campañó Avatar answered Dec 27 '22 03:12

Eduardo Campañó