Open In App

How to Automate Disk Cleanup Using Task Scheduler in Windows?

Last Updated : 27 Sep, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

To keep your Windows system operating at its best, you must remove any superfluous files from it. Using Task Scheduler to automate disk cleanup is one of the simplest ways to make sure it happens regularly. By automating this repetitive task, you may avoid manually cleaning your computer and save time by ensuring that it remains clutter-free. Here's how to use Windows Task Scheduler to automate disk clearing.

How to Automate Disk Cleanup Using Task Scheduler in Windows?

To automate disk cleanup using a task scheduler, below are some steps:-

Step 1: Open Disk Cleanup Utility

  1. You should use the Disk Cleanup program to check which files you want it to remove before we arrange a scheduled task. You'll be able to precisely know what it will clear every time it runs in this manner.

    Search for Disk Cleanup: Type "Disk Cleanup" into the Windows search box, then choose the Disk Cleanup application from the list of results.
  2. Select Drive: Select the drive you wish to clean when prompted—typically, the C: drive.
  3. Select items for Cleanup: The Disk Cleanup utility will examine your drive and present a list of items, including system files, temporary files, and contents from the Recycle Bin, that can be removed. Choose the file categories you wish to remove.

After making your selections for the files you want routinely cleaned, click "OK" to start the process. This is an important step that makes sure you remove the correct files and helps you understand what Disk Cleanup does.

Step 2: Launch the Task Calendar

One of the built-in Windows tools called Task Scheduler lets you automate several system activities, including Disk Cleanup.

  1. Launch the Task Scheduler: Open the application by typing "Task Scheduler" into the Windows search box.
  2. Make a New Assignment: Choose "Create Basic Task" from the Actions pane on the right side of the Task Scheduler window.

Step 3: Assemble the Work

A wizard will now walk you through setting up the automated Disk Cleanup operation.

  1. Give Your Task a Name: Then select "Next." Name your job something like "Automated Disk Cleanup."
  2. Select a Trigger: You must select the frequency at which Disk Cleanup will operate. Daily, weekly, monthly, or whenever your machine boots up are among the options. Weekly or monthly scheduling is usually a decent option for a regular chore like disk cleanup. After choosing your preferred frequency, press "Next."
  3. Decide on the date and time: Indicate the time you'd like the task to begin. You could program it to run every Monday at 3:00 PM, for instance. When finished, click "Next".

Step 4: Select an Action

This step involves instructing Task Scheduler on what to do, which is to launch the Disk Cleanup utility.

  • Choose "Start a Program": Select "Start a Program" from the Action stage of the wizard, then click "Next."
  • Select Disk Cleanup from the Program menu: To launch Disk Cleanup, enter the following command in the "Program/script" field:
cleanmgr.exe
  • Optional: Add parameters: You can add more parameters, such as the following, to tell Disk Cleanup which drive to target and what kinds of files to look for.
/sagerun:1

The /sagerun:1 argument runs a preset cleanup defined in Disk Cleanup. You must first define this preset manually in Disk Cleanup using the command. cleanmgr.exe /sageset:1.

Step 5: Examine and Complete

Check the summary of your task settings, which includes the trigger, action, and time settings, once you've configured the job. After everything is in order, select "Finish."

Now that your job has been established, Windows will carry out Disk Cleanup automatically according to the schedule you provided.

Step 6: Check the Assignment

You can manually test your task by starting it right away to make sure everything goes as planned.

  1. Find the Task: To locate the task you just created in Task Scheduler, click on "Task Scheduler Library."
  2. Run the Task: "Run" can be selected by right-clicking on the job in order to start it right away. By doing this, you can make sure that the Disk Cleanup operates correctly with the parameters you specify.

Tips for Optimizing Disk Cleanup

  1. Customize Cleanup Settings: To generate custom cleanup profiles in Disk Cleanup, use the /sageset parameter. This enables you to target particular files, such as old Windows installations or transient internet files.
  2. Monitor Disk Space: Check your disk space regularly to see if the automated task is efficiently reducing clutter.
How-to-Automate-Disk-Cleanup-Using-Task-Scheduler-in-Windows
Automate Disk Cleanup Using Task Scheduler in Windows

Conclusion

Task Scheduler may be used to automate Disk Cleanup so you can keep your Windows system organized and operating at peak efficiency without having to remember to run the utility by hand. It's an easy-to-use solution that you can set and forget about, keeping your system clear of superfluous files and guaranteeing improved performance over time.


Next Article
Article Tags :

Similar Reads