Ask Leo! by Leo A. Notenboom

How do I change the location of Windows temporary files?

Search First! Then browse: Categories | Full Archive | By Date | Newsletter

Home » Windows » Windows Configuration

Summary: Windows maintains a location where programs can put temporary files. Sometimes you might want to change that location, and it's fairly easy to do so.

In what I do, I have to handle pretty large files all the time. In my setup, I have 3 hard disks:

  • C: which is meant to only run windows and barely has any space on it left after XP was installed.

  • D: which is where I store all my files.

  • E: where I want my temporary files to be.

How would you go about changing the location of the temp folder to E:/ in Windows XP?

Aside from your small C: partition, you're describing a reasonably good set up. By moving your temporary files to E: you should not only get an improvement in available space on C:, but things might also speed up just a tad.

First, I want to be clear to everyone that we're not talking about Internet Explorer's temporary files. Those are controlled by settings in Internet Explorer's options. Similarly, many applications also allow you to specify alternate locations for temporary files used by that application.

We're talking about Windows itself.

Windows has a concept of a directory where it, and other applications if they so choose, can place files that are for temporary use only.

Fire up a Windows Command Prompt, (typically in Start, All Programs, Accessories), and in that windows type SET followed by the Enter key. Windows will list a number of what are called "environment variables" that make various types of information available to running programs. Two of them will look much like this:

TEMP=C:\DOCUME~1\LeoN\LOCALS~1\Temp
TMP=C:\DOCUME~1\LeoN\LOCALS~1\Temp

TMP and TEMP both specify the directory to be used for temporary files. Both TMP and TEMP are used for compatibility reasons. In this example they actually specify "C:\Documents and Settings\LeoN\Local Settings\Temp", but in 8.3 compatibility representation.

Changing them is easy.

Right click on My Computer and click on Properties. In the resulting dialog click on the Advanced tab and you should see something like this:

System Properties dialog, Advanced tab

Click on the button near the bottom labeled Environment Variables, and you'll see something like this:

System Properties, Environment Variables dialog

You may see both TMP and TEMP listed in the section labeled User variables for (account). That's the common location; each different login account is assigned its own temporary location.

Personally, I prefer to have a single location for the entire system. So if TMP and TEMP are present in the top list, I click on each and then click on Delete. However you can simply edit them, as we're about to edit the System copies, if you prefer.

"... some programs can get confused if the temp directory is set to the root of a drive."

If you scroll down in the bottom list labeled System Variables you'll find TMP and TEMP again. Click on one, and then press the Edit button:

System Properties, Edit Environment Variable dialog

In the Variable value: edit box you can now specify a path to a directory that Windows and many other programs should use for temporary files. As you can see, I've specified a different directory entirely, but still on the C: drive. You could specify "E:\" to use all of E: as your temporary location, but I'd actually recommend creating a subdirectory on E:, such as perhaps "E:\temp" and using that, as some programs can get confused if the temp directory is set to the root of a drive.

Be sure and repeat that process for both TMP and TEMP.

You'll need to restart any running programs for the new value to take effect. In fact, you'll need to restart Windows for it to begin using the new value for its own temporary files.

Related:

Helpful? Get new articles weekly by email in my FREE newsletter!

Your Name:
Your Email:


Why Subscribe?

Article C2986 - April 6, 2007

Recent Comments
13 Comments

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Apeke: drives should be listed in Windows Explorer.

You might also try disk manager: Right click on "My Computer", click on
"Manage", click on "Disk Management" and that should show you what you have.

Leo
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)

iD8DBQFGGT4jCMEe9B/8oqERAm4lAJ43CkIh6zs18A/jO6MsTryn+Bb9iwCfR3GX
PaNs22kmVZoWlknDWdukaZc=
=vnem
-----END PGP SIGNATURE-----

Posted by: Leo A. Notenboom at April 8, 2007 12:10 PM

Is there anyway I can change my default location of my music and my pictures folder?

Posted by: Aalok at April 8, 2007 7:25 PM

Thanks for the info. Much appreciate it !!

Posted by: Ð.Sp!dér at July 28, 2007 2:00 PM

At the plcae of C letter , I have %system%
How to make wih this expression ?
Thanks

Posted by: hountsi at April 6, 2008 5:54 PM

I have made the changes above because I had the same problem with a small partition as system disk which kept filling up. I've also moved the location of IE temp files. I now have programmes that won't start - I use Adobe CS3 and non of the programmes will start. I tried uninstall to reinstall and the system said that critical files are missing. When inserting the disc to reinstall CS3, it gets as far as Adobe set up window, then it goes off the screen without continuing set up. Please help - what have I done????? FYI I have renamed temp files G:\Local Settings\Temp. Many thanks

Posted by: Richard at December 19, 2008 4:00 AM

Nice little guide! It might also be beneficial for this person to put their swap file on E: if that's a fast drive.

One thing I can't figure out though: How do you tell Windows XP where to put its Windows Update temporary files? It seems to just pick the drive with the most free space, which is not what I want it to do.

Posted by: Raptor007 at February 24, 2009 3:27 AM

Thank you - you saved me! I have Windows XP on a partition, and I tried copying a batch of files from an external drive to another partition, next thing you know Windows has spat its dummy because the C: drive is full (to the brim!). I was dreading the prospect of having to reboot from scratch, but now I've changed the location of the Windows temp folder - so big thanks!

Posted by: Colin at April 3, 2009 3:47 AM

You may also consider deleting any *.TMP and TEMP folder files with professional software (something like History Killer Pro) on Windows start-up.

Posted by: Artak at May 5, 2009 10:48 PM

How can I install Adobe reader to my E drive?
Dear Leo,Thanks so much for the help. I have a new problem: according to your instruction, I changed TEMP and TMP to E:\TEMP,but the Adobe is a;ways installed to C drive not E drive, very anoying. Please help me to install all temperary file to E drive because my C drive only has less then 15% mem left. Thank you.

Posted by: Diana at September 3, 2009 1:17 PM

Now I can finally use 7-Zip as it uses a temp folder for file extraction, and I ran out of space on C.

Thanks.

Posted by: Yonathan Zarkovian at September 4, 2009 7:51 AM

Post a comment on "How do I change the location of Windows temporary files?":






(Email Address will not be published.)

Remember Me?

By popular demand...
my tip jar
Cuppa Joe
Buy Leo a Latte!

(you may use HTML tags for style)

RSS feed Subscribe to the RSS Feed specifically for comments on this article.

Before commenting, please...

  • Read the article at the top of this page. If your comment shows you didn't, it'll be deleted and ignored.

  • Comment only on this article. Use the Google search box at the top of the page if you have a question about something else.

  • Don't include personal information in the comment. No email addresses. No phone numbers. No physical addresses.

  • Don't spam. Excessive links to unrelated sites within a comment or across multiple comments will cause all such comments to be removed.

  • Don't ask me to recover lost passwords or hacked accounts. I can't, and those comments will be deleted.

  • I can't respond to every comment. And I can't vouch for the accuracy of others who do.

Please wait. Your comment is being processed ...


Question? Ask Leo!