Change the TEMP and TMP environment variables on Windows to move temporary files

Any Windows system administrator who spends a lot of time, for work or passion, looking for the best configuration for his computer or server, certainly knows the environment variables of Windows .
Windows environment variables are aliases or short names that identify particular predefined system paths such as, for example, the user folder, the document folder and also the temporary folder.
Anyone who owns a computer with limited disk space knows how important it is to save disk space by emptying temporary folders.
In the environment variables the predefined paths of the TEMP and TMP folders are specified which are used by external programs to "support" files necessary for their installation or configuration but which, after their use, become useless.
Let's see how the environment variables are changed, how they can be added and, above all, how to change the temporary files folder to prevent the C disk, the one where the system is typically installed, from filling up with useless files that take up space.
The " TEMP " folder is used to store temporary files and folders that are created by Windows services and by the many programs that are installed.
Since these files are stored in the Temp folder (by definition, the temporary Windows folder), it is absolutely safe to remove them.
There are two temporary folders on Windows (not to be confused with temporary folders in Internet Explorer or other web browsers):
- A Temp folder, present in the C: \ Windows folder, used by Windows for its temporary files.
- Another Temp folder located in the " local settings " folder for each registered user.
This second " Temp " folder can be found by typing " % USERPROFILE% \ AppData \ Local \ " in the search box of Windows 7 or Windows 8 or " % USERPROFILE% \ Local Settings \ " in Windows XP and earlier versions.
This folder is different for each Windows user, that is, each logged in user gets a separate folder called " Temp ".
This is the one used by the various programs to store their temporary files such as, for example, the automatic update installation files.
To access and open these 2 "Temp" folders, you must use the following commands to be written in the Search or Run box
TEMP to open the system folder in C: / Windows
% TEMP% to open the temporary folder of the logged in user instead.
These are two aliases specified in the Windows XP environment variable section, Vista and 7.
Depending on your preferences, these environment variables can be modified for various purposes.
You can unify the location of temporary files in a single folder so as to find them all in the same one, you can also specify a different path for both or for one, perhaps moving it to a second hard disk (if the first has space problems) or As an extreme solution, move the temporary folder to a virtual RAM-Disk which is automatically emptied every time the computer is turned off, thus deleting all the temporary files every time.
Moving the TEMP folder can be very useful both to save space on the disk where Windows is installed, and to avoid having to delete temporary files with automatic programs, also having the benefit (in some cases), of speeding up the system.
Changing the Windows environment variables is not difficult:
1) Right click on the computer icon from the desktop or from the Start menu (or press the combination on the Win-Pause / Interr keyboard).
Click on the advanced system settings link in the left pane (You can open them directly with the sysdm.cpl command from the Run or Search box).
2) Click on the Environment variables button.
In the new window that opens, you can read the list of all the variables divided into two groups: at the top there are the variables specific to the user while at the bottom those of Windows.
There are only two user variables: TEMP and TMP which refer to the same directory.
The list of system variables, on the other hand, is longer and, scrolling down, you will still find TEMP and TMP.
3) To change the location of the TEMP folder from C: \ Windows \ Temp, you must first create another folder in the desired location which can also be the second internal hard disk of the computer or a second partition.
Copy the exact path from the window and replace it with the default one.
For example, to move TEMP to the D: drive, you can create the new " TEMP " folder (you can also use another name) in the D: \ drive, and then change the TEMP environment variable indicating the new path (in this example, D: \ Temp ).
To make the modification, select the variable and press the Modify key and change the variable value (without changing the name).
Repeat the step also for the TMP variable indicating the same TEMP folder.
4) If you want Windows to use a single temporary folder, both for the user and for the system, just delete the two TEMP and TMP from the user variables section, or you can indicate the same folder for everyone.
In this way, both the temporary files of Windows and those of the other programs will be saved in the same folder which can be emptied from time to time (see also how to delete temporary files on Windows quickly in one click).
5) If instead you wanted to make sure that the TEMP folder is always empty every time you turn on the computer, you must install a RAM-DISK.
To create a RAM Disk, simply install a program that brings up a new disk drive in the computer resources, the space of which is represented by the RAM memory.
The RAM memory is the one that is emptied every time the PC is turned off, therefore, every file that is saved in the Ram Disk unit is automatically deleted.
It therefore becomes an excellent way of keeping the space occupied by temporary files always zeroed, which, as mentioned, once created, are no longer needed.
To finish the discussion, we also see how to create new environment variables by pressing the " New " button.
You can then enter the name that becomes the alias to recall them and then indicate a path, an email address, a website or even the executable of a program (without ever using the quotation marks).
For example, creating the variable " Navigaweb " and putting " www.navigaweb.net " as a value, just go to the Run or Search box, write Navigaweb to open the browser directly on this site.
There can be many uses for these variables, especially if used to program batch scripts.

Leave Your Comment

Please enter your comment!
Please enter your name here