Skip to main content

Automate Disk Cleanup

Posted February 2003 by Steve Sinchak

Cleanmgr.exe is designed to clear unnecessary files from your computer's hard disk. You can use command-line options to specify that Cleanmgr.exe cleans up certain files. You can then schedule the task to run at a specific time by using the Scheduled Tasks tool.

To start the Disk Cleanup tool, either run the Cleanmgr.exe command, or click Start, point to Programs, point to Accessories, point to System Tools, and then click Disk Cleanup.

Disk Cleanup supports the following command-line options:

  • /d driveletter: - This option specifies the drive that you want Disk Cleanup to clean.
  • /sageset: n - This option displays the Disk Cleanup Settings dialog box and also creates a registry key to store the settings that you select. The n value, which is stored in the registry, allows you to specify tasks for Disk Cleanup to run. The n value can be any integer value from 0 to 65535. To have all of the options available when you use the /sageset option, you might need to specify the drive where Windows is installed.
  • /sagerun: n - This option runs the specified tasks that are assigned to the n value if you use the \sageset option.

For example, in Scheduled Tasks, you could run the following command after you run the cleanmgr /sageset:11 command: cleanmgr /sagerun:11

This command runs Disk Cleanup and includes the options that you specified with the cleanmgr /sageset:11 command.

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