Ankit_Add

Sunday, June 21, 2015

Where Does Windows Store Temporary Files and How to Change TEMP Folder Location?

Whenever we talk about free-up disk space on Windows PC, we always suggest to clear "TEMP" folder. Deleting all files and folders present in "TEMP" folder might provide you a decent amount of free space.
You might be wondering what is this "TEMP" folder and why is it created by Windows? "TEMP" folder, as the name suggests, is used to store temporary files and folders which are created by Windows services and many 3rd party software programs. Since the files and folders stored in Temp folder are temporary, its absolutely safe to remove them.
Now the question comes how to access this Temp folder to clear its content. There are 2 Temp folders present in Windows OS:
  • Temp folder present in C:\Windows folder
  • Temp folder present in Local Settings folder for each logged-in user
First "Temp" folder which is found in "C:\Windows\" directory is a system folder and is used by Windows to store temporary files.
Second "Temp" folder is stored in "%USERPROFILE%\AppData\Local\" directory in Windows Vista, 7 and 8 and in "%USERPROFILE%\Local Settings\" directory in Windows XP and previous versions. This folder is different for each Windows user i.e., each logged-in user gets a separate "Temp" folder. This "Temp" folder is used by 3rd party programs to store their temporary files for example, temporary downloaded parts of files by your download manager software, etc.
To access these 2 "Temp" folders, you need to use following commands:
  • TEMP
  • %TEMP%
You can run these commands in RUN dialog box or start menu search box. When you run TEMP command, it opens system "Temp" folder stored in C:\Windows directory and when you run %TEMP% command, it opens the user temp folder stored in "%USERPROFILE%" directory. You can learn more about these kind of environment variables using following tutorial:
List of Environment Variables in Windows XP, Vista and 7
Today in this tutorial, we'll show you how to tell Windows to use a single "Temp" folder for both system and user temporary files so that we don't need to open 2 different folders to free-up disk space.
We'll also learn changing location of "Temp" folder from C:\ drive to some other partition. The reason behind changing the location is very simple! First, it'll not eat valuable disk space of our system drive. Second, we'll not need to worry about clearing content of Temp folder regularly to free-up disk space on C: drive. It might also speed up your system a little bit.
So without wasting time, lets start the tutorial:
1. Right-click on Computer icon on Desktop and select Properties (or press WIN + Pause/Break keys). Now click on Advanced system settings link in left side pane. (You can open it directly by giving sysdm.cpl command in RUN or start menu search box)
2. Now click on Environment Variables button. It'll open a new window which will show a list of all environment variables defined in your Windows.
There would be 2 different sections:
  • User variables
  • System variables
You'll see TEMP and TMP variables listed in User variables section. The System variables section will contain a long list of various environment variables along with TEMP and TMP variables as shown in following screenshot:
Default_TEMP_Environment_Variable_Windows.png
3. Now to change location of TEMP folder from C:\Windows\Temp to other partition, first we'll need to create a new TEMP folder in the desired partition.
In this example, we are going to move TEMP folder location to D:\ drive, so we'll create a new folder "TEMP" in D:\ drive. Please note that you can use any name for the new folder, its not necessary to have TEMP as its name.
Now you can double-click on the TEMP variable present in System variables section or select it and click on Edit button. Now type location of new TEMP folder (which is D:\Temp in our case) and click on OK button.
Repeat same step for TMP variable as well.
That's it. It'll change the location of TEMP folder in Windows.
4. Now we'll ask Windows to use a single TEMP folder for both system and user temporary files. We can do this by either deleting both TEMP and TMP variables listed in User variables section or edit the variables and set their values to the same folder which we used for system variables in step 3 i.e., D:\Temp folder.
Once you delete both variables in User variables section or set their values to new TEMP folder path, it'll tell Windows to use a single TEMP folder to store all temporary files and folders created by Windows as well as 3rd party software programs.
Changing_TEMP_Environment_Variable_Windows.png
5. You'll need to restart your system to take effect.