Wednesday, July 13, 2011

How To Automatically Keep Windows 7 Clean Of Obsolete Files


Windows has a way of collecting virtual dust, a circumstance that has not changed considerably in Windows 7. These obsolete files take up space and contribute to hard drive fragmentation. While neither of this is a big issue, it is an annoyance, one that you can easily take care of.

In this article I will show you a simple way to regularly and automatically clean your Windows 7 system. This won’t require you to install yet another cool tool and is thus low on system resources. At the same time you will also learn how to automatically run other tools for other tasks.

There are several tools that can remove temporary files and keep your computer free from clutter, for example CCleaner. However, these programs themselves take up hard drive space and consume system resources, thus adding to the problem rather than solving it. In fact, Windows comes with an accessory utility called Disk Cleanup, which does a pretty good job at freeing up space on your hard drive by removing temporary files, emptying the Recycle Bin, and deleting other obsolete files.

windows 7 disk cleanup

You can run the tool manually by going through > Start > All Programs > Accessories > System Tools > Disk Cleanup. However, you can also schedule an automatic disk cleanup and that’s the procedure I am going to show you in this article.

1. Open Task Scheduler

Go to > Start and type > task scheduler in the search box, then hit > Enter.

task scheduler

2. Create Basic Task

In the Task Scheduler windows go to > Action and select > Create Basic Task…

create basic task

3. Setup Task With Task Wizard

The previous step opened the Task Wizard. In the first window enter a name and description for your task, then click > Next.

basic task setup wizard

The Task Trigger determines when the task will be launched. In this case I want to the Disk Cleanup utility to run on a weekly basis. Click > Next to set the day and time.

schedule task

When you have decided on a schedule, click > Next to set an Action.

automatically launch task

Here we want to > Start a program. Select the respective option and click > Next.

run system tool

Enter the link to the respective utility in the > Program/script: field. The link for Disk Cleanup is > C:\Windows\System32\cleanmgr.exe. To run the tool automatically, without requiring your input, also add the command > cleanmgr.exe/sagerun:1 into the > Add arguments (options): field.

autorun program

Click > Next once more to see an overview where you can check your settings and then hit > Finish to save the task. In this configuration, the tool will run with default settings.

4. Change Disk Cleanup Settings

Naturally, it is desirable to change the default settings to suit your preferences. First of all, you basically need to save your preferred Disk Cleanup settings in a profile. Then you manipulate the command in the > Add arguments (optional): field above, to point to the instance of Disk Cleanup you launch with your scheduled task to the profile you created. This way you can set up multiple scheduled tasks, running different Disk Cleanup profiles. Now let’s see how that works.

Click > [WINDOWS] + [R] key combination to launch the Run Windows. Type in > Cmd and click > OK.

change disk cleanup settings

In the DOS-like window that pops up, type in > cleanmgr /sageset:3 where ’3′ will be your new profile.

command line

The Disk Cleanup Settings window will launch. Select which files you wish to have cleaned, then click > OK to save your settings in a registry key.

customized disk cleanup

Now return to your scheduled task. Launch the Task Scheduler as described in step 1 above. Your task will be listed in the top middle column in the Task Scheduler window. Double-click the task, then switch to the > Actions tab and double-click the > Start a program action. In the > Edit Action window change the number for the > sagerun command to your profile number, for example to > cleanmgr.exe/sagerun:3

edit scheduled task

That’s it! For more information about how to manipulate the Disk Cleanup utility, check out this Microsoft Support article.

For more tips and tricks on how to keep your Windows system lean and clean, check out these articles:

What tools have you been using to clean your hard drive?

No comments:

Post a Comment

[Please do not advertise, or post irrelevant links. Thank you for your cooperation.]