How to change the default location for the temporary file folder to a
different hard disk?
In most cases there’s no reason or need to fiddle with this setting; it’s
default setting is quite appropriate for most common usage.
That “different hard disk” you mention in your question actually opens the
door to some scenarios where it actually is a useful setting to change.
I’ll show you how and then discuss some of the scenarios where it might make
sense to change.
Become a Patron of Ask Leo! and go ad-free!
TMP versus TEMP
First, let’s clear up one point of confusion.
For historical reasons, settings called both TMP and TEMP are used to
indicate the temporary folder that Windows will use. “Historical Reasons” means
that the setting is called “TMP” on the Unix operating system from which much
of this geekery was modeled, but someone along the way said “it should be more
readable” and added the “E” to turn it into something more like a word. The
problem of course is that not all programs changed, and thus both had to be
the temporary folder make some amount of sense, and both involve using a
It’s not uncommon for things that seem odd to be there because of “backwards
compatibility”, and this is one.
Unless I say otherwise, I’ll use TMP to refer to both TMP and TEMP.
My TMP Versus Your TMP Versus Windows TMP
Windows is a multi user operating system, even though we typically run it
one user at a time and even then Windows itself is kind of its own user.
The upshot is that each user login gets its own TMP setting, and the
operating system gets its own as well.
Thus, there can be many TMPs.
Show Me Your TMP
Let’s look at where to change ’em.
Right click on “My Computer”, or “Computer” – either in the start menu or
desktop – and click on Properties.
Click on Advanced, or Advanced System
Settings and you should get a dialog much like this one:
Click on the Environment Variables button to get this:
Right away you can see that the TMP settings for the currently logged-in
user – me in this case – are displayed right at the top. %USERPROFILE% is
replaced with “C:\Users\LeoN” in my case, so the temporary files are actually
If you click in the lower box and scroll down, you’ll see that there’s
another pair of settings:
As you can see, both TMP and TEMP are here as well, and are set to
The operating system will use “C:\Windows\Temp” as its temporary files
folder, and programs that you run will use
One Simple Change
To the best of my knowledge you don’t need both. By that I mean you don’t
really need separate settings for your login accounts and for the system. (If
you’re at all hesitant, you don’t need to make this change.)
So one approach that I frequently use is to simply delete the TMP and TEMP
settings from the “User variables” portion. Click on each, click on Delete and
If you have no user-specific TMP setting, the system setting will be used
instead. In other words, all the temporary files will end up in the same
Changing the Location
To change the value of the TMP and TEMP variables, double click on one to
get this edit box, and type in the new value:
Here you can see I’ve replaced the value with “d:\tmp”, a folder I’ve
created on one of my hard drives.
Press OK, repeat for TMP, and you’re done.
Well, you may have to reboot for the changes to take effect.
A couple of notes about making the change:
- The folder must exist – Windows will not create it for you.
If it doesn’t exist, it’s unclear what will happen, but most likely Windows
will put the temporary files is a random location, or some programs may not
work at all.
- As I said, you may need to reboot for the changes to take effect
- Only after you reboot should you clean up the “old” temporary folders. I
recommend removing their contents but leaving the empty folders around.
- Resist the urge to get tricky with the folder names or paths. The TMP
setting is used by many, many programs some of which may not behave properly
with spaces in file names, lengthy paths, or settings that are anything other
than simple. Yes, even after all this time.
There are two scenarios where changing the location of the temporary folder
makes some amount of sense, and both involve using a different
drive. If you’re moving it from one location on C: to another location on C:,
you’re not really improving anything.
Speed: If you have a separate physical drive, it
can sometimes be a small speed improvement to place your temporary files on
that drive. Exactly how much, or even if this will benefit you is extremely
dependent on your system configuration and how you use your computer. It’s even
possible that it could slow you down. But since it’s a relatively simple
change, it’s one of those changes that you can experiment with to see if the
results are beneficial.
Space: If your C: drive is filling up, but you have lots of
space on, say D: – then moving the temporary files folder can allow you to free
up that space on C:. In this case C: and D: could be two partitions on the same
drive, or different drives, it doesn’t matter. My only suggestion is that you
first empty your TMP folder before you go through the effort of moving it –
things frequently accumulate there and a simple cleaning may well resolve your
Finally, be aware that this is not related to your internet
browser in any way. Your “Temporary Internet Files” is a different animal
completely, and is controlled by the web browser or other internet program you
happen to use.
9 comments on “How Do I Change the Location of the Windows Temporary Files Folder – and Should I?”
I’ve often wondered why there as so many TMP/TEMP folders lying around, and why one is used versus the other.
Seems obvious now, but something I hadn’t thought of before. That explains it.
Another great article. Thanks Leo!
Don’t do this with Vista, as some programs can’t cope with it, and give puzzling error messages. E.g. SP1 installation, Acronis True Image 11.0 installation. It’s OK with XP.
I probably would do this because I have a tiny boot drive for safety – 30 gb [ virus, etc ]and all real data is stored on other mirrored drives but haven’t had the need since the only things on the boot drive is the OS and programs folder – less than 10 gb. The temp folder has plenty of space to play with.
Is it possible to use a RAM disk for storing temp files. The advantage, providing this can be done, would be faster speeds since writing to RAM would be faster than writing to hard disk. Additionally the temp files would get cleared on re-boot. If this is practicable and feasible how does one go about doing this? Is it possible to create a RAM disk using a batch file which will get executed at start up?
I’ve changed that setting once and forgot to create that folder and started seeing a folder popping up all over the place with just the letter c as the name. There was one in Windows and some program folders had one, if I remember correctly.
The reason i changed my TMP folder is because my C: drive is a SSD dirve.
The benefit is they are realy fast in reading, the major disadvatage with these drives is they are very, very slow in sequential writes.
My next (storage) drives are normal harddrives, for TEMP drive its far more better to use a conventional drive (TEMP folder and IE cache) than a SSD.
I used your example and my computer is flying, thanks a million! -JW-
This is for Uday Rege, who wanted to know whether it might be possible to use a RAMdisk for his TEMP folder.
This is theoretically possible — but UTTERLY inadvisable, and that for at LEAST two reasons:
1. Firstly, badly-written or ill-behaved programs sometimes actually put their executables there! With the natural consequence that a program stored in the TEMP folder isn’t “temporary” at all! There is no conceivable good reason for any program to do this, but some have been known to do so, so be warned: emptying your TEMP folder (which SHOULD be harmless) may actually BREAK something!
2. Secondly (and far more importantly) the TEMP folder is very frequently used by installation programs during the reboot sequence to store “partial installer programs”, the running of which continue or complete the installation of some program that was begun prior to system reboot. If that folder happense to be a RAMdisk, that gets cleared every time you reboot your computer, well, guess what? That program you’re trying so hard to install, will either NEVER install at all, or else never install completely or correctly, as the files it needs to complete installation on reboot vanish out from under it during the reboot sequence!
Bear in mind, that installation programs of this kind — the kind that need a reboot to complete their installation, and pick up with and continue the installation after reboot — frequently include “patches”… including those supplied by Microsoft, among others.
Catch my drift? It may sound like a nifty idea, but DON’T do it!
A third reason for moving not only TMP/TEMP but also Temporary Internet Files and similar ephemerals is when using something like RegShot, a simple but v. useful wee program that can take and compare different snapshots of any or all drives, plus your registry, enabling you to compare before-and-after scenarios.
By moving temp file locations of all sorts (pagefile/hiberfil.sys are ignored automatically) to a dedicated, and unmonitored, drive, the differences to be examined are much reduced.
You say that “The TMP setting is used by many, many programs some of which may not behave properly with spaces in file names”…
One comment – the same applies for user names. When I setup my computer I had a space in my username and now my %userprofile% expands to a path with a space in it. I have only had one thing cause me problems because of this in the last 8 years or so and that was a batch file distributed to patch a beta program failed because they didn’t enclose the userprofile variable in “” marks.