Skip to main content

A better disk cleanup

Posted February 2003 by Steve Sinchak

A Better Disk Cleanup

This tip will show you how to create an unattended disk cleanup which will also empty your prefetch folder.  This tip assumes you have Windows XP installed in c:\windows.

**Step 1.**Create a new text file and place the following contents inside:

c:\windows\system32\cleanmgr.exe /dc /sageset: 1
c:
cd \ cd c:\windows\prefetch
del *.* /q

**Step 2.**Save the file, changing the extension from .txt to .bat
For this tip's purpose, we will call it clean.bat

**Step 3.**Execute the file.  This will run the Disk Cleanup program in a special mode which asks what items you will want cleaned when Disk Cleanup performs an unattended cleanup.  Check the items you wish to have cleaned up, then click OK.

**Step 4.**Right-click on the clean.bat file and click edit.  Change the first line to read:

c:\windows\system32\cleanmgr.exe /dc /sagerun: 1

Step 5.
Save the file.  You can execute this file in place of running Disk Cleanup, or, to have this program run unattended, run the Add Scheduled Task Wizard in the Control Panel and create a scheduled task using the clean.bat file you just created.

Note:  This cleanup script will also clear windows prefetch directory.  Often this directory can become cluttered with old appication and a cleaning would free up disk space but it will result in a one time performance decrease and windows has to rebuild the cache with active software afterwards.

Related Posts


If you own a Google Chromecast streaming device, you can easily share a browser tab in Chrome browser or even your entire desktop.  This can be very useful when presenting from your laptop or if you just want to watch something on a big screen that is only on your PC.  The only requirement is you must be on the same network as your Chromecast...

Read More

If you are a fan of minimalist desktop experiences, hiding the desktop icons are an easy way to clean up the Windows interface.  Instead of saving everything to your desktop, use the default profile folders such as downloads and documents.  Actually hiding all the icons on your desktop is a very simple customization hidden in the right-click context menu.  Just right-click on the desktop, select View...

Read More

Google security researchers have published details about a major security flaw found in the SSL protocol that is used to encrypt data transferred between your browser and a web server. SSL is typically used in situations where logon credentials are validated...

Read More

Enabling two-factor authentication is a great way to add an additional level of protection to your Microsoft account.  Even if your password is stolen, your account is still protected because two-factor authetication requires an additional level of verification to log in. Microsoft calls their version of two-factor authentication "two-step verification" and it works by providing you with a random code...

Read More