Any Windows system administrator who spends a lot of time, for work or passion, looking for the best configuration for their computer or server, surely knows the Windows environment variables. Windows environment variables are aliases or short names that identify particular system predefined paths such as, for example, the users folder, the documents folder and even the temporary folder.
If you have a computer with limited disk space, you know how important it is to save disk space by emptying temporary folders.
The environment variables specify i default paths of TEMP folder and TMP folder 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 then how environment variables are changed, how you can add them and, above all, how to change the temporary files folder to prevent the C drive, the one where you typically install the system, from being filled with useless files that take up space.
Folder "TEMP"is used for store temporary files and the folders that are created by Windows services and the many programs that are installed.
Since these files are stored in the Temp folder (by definition, the Windows Temp folder), it is absolutely safe to remove them.
There are two temporary folders on Windows (not to be confused with temporary folders in Chrome 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% AppDataLocal" or "% USERPROFILE% Local Settings" in Windows XP and earlier versions in the Windows 7, 8.1 or Windows 10 search box.
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 various programs to store their temporary files such as automatic update installation files.
To access and open these 2 "Temp" folders, you need to use the following commands to write 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 environment variables section of Windows 10, Windows 8.1 and 7.
Depending on your preferences, you can modify these environment variables for various purposes.
You can unify the location of temporary files in a single folder so as to find them all in the same, you can also specify a different path for both or just one, maybe moving it to a second hard disk (if the former had space problems) or, as a last resort, move the temporary folder to a RAM-Disk virtual file that is automatically emptied each time the computer is turned off, thus deleting all temporary files each time.
Move the TEMP folder can be very useful for both save disk space 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.
Change the Windows environment variables it is not difficult:
1) Right-click on the computer icon from the desktop or Start menu (or press the Win-Pause / Break keyboard combination).
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 user-specific variables while at the bottom those of Windows.
There are only two user variables: TEMP e TMP which refer to the same directory.
The list of system variables instead is longer and, scrolling down, you will still find TEMP and TMP.
3) To change the location of the TEMP from C: WindowsTemp, 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 change, select the variable and press the Edit key and change the variable value (without changing the name).
Repeat the step also for the TMP variable indicating the same folder as TEMP.
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 all of them.
In this way, both the Windows temporary files and those of the other programs will all be saved in the same folder that can be emptied from time to time (see also how to delete temporary files on Windows quickly in one click).
5) If you wanted to do so instead the TEMP folder is always empty every time you turn on your computer, a RAM-DISK must be installed.
To create a RAM Disk just install a program that makes a new disk drive appear in the computer resources, the space of which is represented by the RAM memory.
The RAM memory is the one that empties 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 to keep the space occupied by temporary files which, as mentioned, once created, are no longer needed.
To finish the speech, let's also see how create new environment variablesby 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 quotes).
For example, by creating the variable "convertresources" and putting as value "www.convertresources.com", just go to the Run or Search box, write convertresources to directly open the browser on this site.
There can be many uses for these variables, especially when used to program batch scripts.