Folder Temp: cleaning with a script

actively working operating system, be it Windows or Unix - it's always a lot of newly created files, which are called temporary, in Russian - time.It may be the intermediate results of Photoshop, Nero, Open Office, Internet Explorer, Firefox, and various software programs.In order to camouflage saved and viruses.The hard disk has several directories under a single name Temp, which store data files.

First, just on drive C :, and then in a folder, Windows, and in the Documents and Settings (subfolder Local Settings).In addition, the location of the Temp-ovyh files depends on the "brand» Windows, installed on your PC.For example, in Windows Seven, they are stored in six different ways.

Months PC use the Temp folder grows to alarming proportions, with hundreds of megabytes of useless, so it would be nice to set up her clean!At the same time should be to defragment the hard disk.To realize this can be all sorts of ways.For the average user the easiest way to run a special utility that allows you to clean temporary files.The most popular of them - Ccleaner and Glary Utilites.

You can also use a standard tool for cleaning the system.In Windows XP and later versions of this method is approximately the same for execution.Just go to the properties of the disc in the "Explorer" (by right-clicking on the selected drive C :) and click "Disk Cleanup."The main drawback of the method - not all deleted files.

eliminated lack of use of the listed third party utilities.In addition to this method, you can use the browser, because the Temporary Internet Files - a species of "garbage" files that often accumulates more of them than the folder Temp, and occupies considerable space on the hard disk.

For Firefox you can use the menu "Tools" & gt;"Clear History".It is necessary to choose the cookies and cache.If you're still using Internet Explorer, there can delete temporary files by using the icon "Options" on the control panel.Name of the subsection that you need - "Temporary Internet Files".To clean, use a couple of buttons catalogs - "delete cookies" and "Delete Files."

So, we have described the ways of how to remove the temporary files of Windows 7 and previous generation systems for "mere mortals".But still, there are methods that use the programmers and administrators.Most often they use scripts.You too can do the same.Clear advantages of scripts - automation.Let's look at how to get rid of temporary files using the embedded and regular execution of the script.Take the most relevant for today system - Windows 7.

1. Create the root of the C: drive object "folder Temp".

2. Right-click the need to go to the properties of the icon "My Computer" the lowest point "Advanced" tab.Select the "Environment Variables".It is necessary to change the variables TMP and TEMP to the path C: \ Temp.

3. Then, in a notebook you should write the following lines: pushd% TEMP% & amp; & amp;rd / s / q.& gt;nul 2 & gt; & amp; 1 pushd C: \ TEMP & amp; & amp;rd / s / q.& gt;nul 2 & gt; & amp; 1.Save the file as cleartmp.cmd strictly with the specified extension directly to disk C :.

4. Use the Policy Editor (the launch of the "Start" & gt; "Run" & gt; "gpedit.msc") adds the script to the system, using the tab "Configuration Windows" in "Computer Configuration."It is necessary to choose "Scripts Startup / Shutdown Computer" and go to the properties of the item "Shut Down."Then, using the "Add" button to show the path to the script, which will be cleaned temporary folder.

5. The "User Configuration" (the "Configuring Windows" & gt; "Scripting the Start / Stop" & gt; "Shut Down") is subjected to the same treatment.Chances are, you already understand that all of these mandatory items Temp folder each time will be cleaned during shutdown, you do not need to run the program.Of course, it is possible to realize such a script using the task manager, but it is much more intended scope of this article.