Monday, January 17, 2011

Scheduling Data Cleanup on Windows Operating System for Performance Improvement

These steps are to schedule the disk cleanup and defragmentation tasks to contribute to performance improvement efforts on windows operation system. These are by no means only methods to improve performance, but if you do these on your machine, you may see a little bit faster response. I did these on my Windows XP machines.

A. Deleting the Cache, Cookies, Temporary Internet Files and Temporary Windows Files
1. Open Notepad.
2. Paste the following commands in it
C:\

cd C:\Documents and Settings\%USERNAME%\Cookies
del /F /S /Q *

cd C:\Documents and Settings\%USERNAME%\Local Settings\Temporary Internet Files
del /F /S /Q *

cd C:\Documents and Settings\%USERNAME%\Local Settings\Application Data\Temp
del /F /S /Q *

cd C:\Documents and Settings\%USERNAME%\Local Settings\Temp
del /F /S /Q *

cd C:\WINDOWS\Temp
del /F /S /Q *
3. Save the file on C drive with ".bat" extension. My saved file is named "delCacheCookiesAndTempInternetFiles.bat"
4. Go to Start -> Programs -> Accessories -> System Tools -> Scheduled Tasks
5. Click on "Add Scheduled Task".
6. Click Next on the window that pops up.
7. On the subsequent window, click "Browse"
8. Browse to C:\delCacheCookiesAndTempInternetFiles.bat
9. Select the frequency to run this scheduled task as per your choice. I run it weekly once.
10. Select other parameters for the scheduled task and save it. (I would suggest select the time to run within next 5 mins and see if it actually starts and runs at that particular time. Once you see it running successfully, you can change the scheduled run time to some other time per your preference.

B. Schedule Disk Cleanup to Run Automatically
1. Goto Start -> Run -> Type "cmd"
2. Paste the command "cleanmgr /sageset:1" and hit Enter.
3. It opens a dialog as shown below:
4. Check your preferred checkboxes on this screen and click "Ok"
5. Go to Start -> Programs -> Accessories -> System Tools -> Scheduled Tasks
6. Click on "Add Scheduled Task".
7. Click Next on the window that pops up.
8. On the subsequent window, click "Browse"
9. Browse to "c:\windows\system32\cleanmgr.exe"
9. In the "Schedule" tab, select other parameters for the scheduled task. Select the frequency to run this scheduled task as per your choice. (I run it monthly once.) Click "Ok" to save the scheduled task.
10. Go to Start -> Programs -> Accessories -> System Tools -> Scheduled Tasks
11. Right click on the task "cleanmgr", go to "Properties".
12. In the "Run" textbox, edit the text to append "sagerun:1"
13. Select other parameters for the scheduled task and save it. (I would suggest select the time to run within next 5 mins and see if it actually starts and runs at that particular time. Once you see it running successfully, you can change the scheduled run time to some other time per your preference.


C. Schedule Disk Defragementer to Run Automatically
1. Go to Start -> Programs -> Accessories -> System Tools -> Scheduled Tasks
2. Click on "Add Scheduled Task".
3. Click Next on the window that pops up.
4. On the subsequent window, click "Browse"
5. Browse to "C:\WINDOWS\system32\defrag.exe"
6. Select the frequency to run this scheduled task as per your choice. (I run it weekly once.) Click "Ok" to save the scheduled task.
7. Go to Start -> Programs -> Accessories -> System Tools -> Scheduled Tasks
8. Right click on the task "defrag", go to "Properties".
9. In the "Run" textbox, edit the text to append "C:". This is how you are specifying which drive the defragmenter should run.
10. In the "Schedule" tab, select other parameters for the scheduled task. Click "Ok". (I would suggest select the time to run within next 5 mins and see if it actually starts and runs at that particular time. Once you see it running successfully, you can change the scheduled run time to some other time per your preference.
You do not need to follow this procedure for scheduling Defragmentation in Windows 7. Windows 7 has its own scheduler for Defragmentation accessible from Disk Defragmenter Application itself.

1 comment:

Anonymous said...

I have Windows Vista and I run diskcleanup with CCleaner manually. For defrag, I gave up using the Vista program as it lacks a visual display and the schedlued task does not always run. I got an automatic commercial defrag program that also has a VSS mode and does the job reliably.