Where is the best place to save temporary files in Windows Where is the best place to save temporary files in Windows windows windows

Where is the best place to save temporary files in Windows


If you are using .NET, please use Path.GetTempPath(). This will guarantee that you use the temporary directory assigned to the user that runs your application, regardless of where it is stored.

If you browse the file system, you will notice that there are many "temp" directories:

  • ~\Temp
  • ~\Windows\Temp
  • ~\Users\userName\AppData\Local\Temp

... and many more. Some of these paths are OS-dependent, and won't be present on certain windows flavors. So, save yourself some time and hassle, and let the .NET framework figure out where the "temp" path is located.


Use GetTempPath and and possibly GetTempFileName to determine where to put your temporary files. This is the most reliable, enduser-friendly, and future proof way to get a temporary location for files.


In the temp directory?

Use GetTempPath or in a batch file %TEMP%