Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

If I look at my %TEMP% folder (that is, C:\Documents and Settings\Me\Local Settings\Temp\), I see some applications stick stuff in there, and some applications stick it into a subfolder off there. Sometimes those subfolders have names that can be traced back to the application or the author, and some are random.

  • Is there any best practice here?
  • Does it matter?
  • Does the whole folder get deleted if you do a disk cleanup?
  • What about C:\Windows\Temp? When is that used by applications other than Windows itself - if ever?
share|improve this question
add comment

3 Answers

up vote 3 down vote accepted
  1. There is no best practice I'm familiar with. It is a directory for temporary files, and it is most likely going to look like a garbage can. As a developer, I find it easier for me to create a directory with my application's name and place all my files there, and even clean it if I can. But I think that is just a good habit - nothing that the OS will be upset about.

  2. It matters only to those that need these files. If you generate a lot of files and used them later - you need to keep track of them. It is easier when they are all in the same directory. Also, every operating system has a limitation to how many files a directory can hold, so it is never good practice to put many files in the same directory.

  3. Disk Cleanup allows you to delete it - it is not done automatically unless you configure it somehow.

  4. I personally favor C:\WINDOWS\Temp - so I change my %TEMP% to point to it. It is usually internal for Windows components, but Windows works fine if my junk goes there as well. I recall someone once told me that everything under C:\Documents and Settings\myuser is a part of the user profile - so the less files there the faster your computer is. I don't know if it is true, but I avoid putting temporary files there anyway.

share|improve this answer
    
...Cosmin was a close second –  rossmcm May 23 '11 at 11:27
add comment

Is there any best practice here?

Not really. If you need only one temporary file you can create it directly in Temp. If you have more than one, you should create a folder.

Does it matter?

For the user and target machine it doesn't matter. It's all about how you organize your temporary folders.

Does the whole folder get nuked if you do a disk cleanup?

No. Only old files which were not accessed recently are deleted.

What about C:\Windows\Temp. When is that used by apps other than Windows itself - if ever?

It's not recommended to use this folder. All applications should use the user profile temp folder for their temporary files.

If you need to store files in this folder, your approach is incorrect. For example, if you have some information you need to share with all user accounts, you should use a folder in ProgramData.

share|improve this answer
add comment

C:\windows\temp is used by processes running as Local System, Local Service, and Network Service.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.