How to Automate Disk Cleanup Using Task Scheduler in Windows?
Last Updated :
27 Sep, 2024
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
- 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. - Select Drive: Select the drive you wish to clean when prompted—typically, the C: drive.
- 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.
- Launch the Task Scheduler: Open the application by typing "Task Scheduler" into the Windows search box.
- 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.
- Give Your Task a Name: Then select "Next." Name your job something like "Automated Disk Cleanup."
- 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."
- 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.
- Find the Task: To locate the task you just created in Task Scheduler, click on "Task Scheduler Library."
- 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
- 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.
- Monitor Disk Space: Check your disk space regularly to see if the automated task is efficiently reducing clutter.
Automate Disk Cleanup Using Task Scheduler in WindowsConclusion
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.
Similar Reads
How to Create a Bootable USB Flash Drive in Windows Using CMD
Want to install new Windows on your computer using a USB drive and looking for a way to create a bootable USB? Then you can do it with a simple tool built into your computer called CMD (Command Prompt), and you donât need any extra software. This guide will show you 12 easy steps to turn your USB in
5 min read
How to Automatically Delete Old Files in Windows 11?
Managing storage space efficiently is crucial for maintaining a smooth and responsive system. Windows 11 offers built-in features to help you automatically delete old files, freeing up valuable disk space without manual intervention. Whether you're looking to manage temporary files, downloads, or ot
6 min read
How to Use the Xcopy Command in Windows?
The xcopy command in Windows is a powerful tool for copying files and directories. It extends the functionality of the standard copy command by allowing the copy of entire directories along with their subdirectories and files all at once. This makes xcopy highly useful for tasks such as backing up f
5 min read
Backup & Restore Files using Windows File History
File History is an integrated backup system in Windows 10 and it replaced the earlier version of Windows Backup & Restore. One just needs a good size USB thumb drive or an external hard drive that is plugged in through the USB ports. Once it's plugged in, then the system will know that there's a
5 min read
How to Use Storage Spaces in Windows 11/10?
The Storage Spaces feature in Windows 11/10 allows you to combine multiple drives into a single virtual disk to enhance storage performance and redundancy. Whether you're using Windows 11 or Windows 10, learning how to use Storage Spaces can help you manage your storage efficiently. This guide will
6 min read
How to Create a Recovery Drive in Windows 11? (4 Simple Steps)
Creating a recovery drive in Windows 11 is an essential step to ensure you can troubleshoot and repair your system in case of any issues. This simple process allows you to create a bootable USB drive that contains the tools needed to fix problems, reset your PC, or restore your system. In just four
4 min read
How to Open Windows PowerShell as an Admin in Windows 11?
Windows Powershell is a powerful command-line shell and scripting language devised for administrators and professionals. PowerShell with administrative privileges in Windows 11 makes it possible to carry out tasks with superior permissions. This article will discuss several ways of opening Windows P
4 min read
How To Free up Drive Space in Windows
Running out of storage on your Windows PC can be really frustrating, canât it? It turns out that nearly half of all usersâregardless of whether you're a student, a gamer, a designer, or just someone who uses their computer casuallyâexperience this same challenge. Having low storage space can really
9 min read
How to Create a Batch File in Windows?
A batch file is a straightforward text document in any version of Windows with a set of instructions meant to be run by Windows' command-line interpreter (CMD) by maintaining all the functions. Batch files are a great tool for streamlining internally configured processes, automating tedious jobs, an
5 min read
How to Repair Windows 10 Using Command Prompt - 5 Methods
Is your Windows 10 not working right? Maybe itâs slow, keeps crashing, or wonât start properly. These problems can be annoying, but you donât have to do something big like reinstalling Windows yet. Thereâs a handy tool called Command Prompt that can fix many Windows issues, and itâs already on your
6 min read