The Categorizer

the categorizer logo

How To Delete Temporary Files Automatically in Windows 11

It seems that you want to automate the task of cleaning temporary files on your computer so that you can focus on other important tasks without moving out of storage.

13.4% of the total storage is filled with temporary files

Data storage is already one of the biggest problems in computing. By default, Windows doesn’t delete the temporary files automatically, it becomes more terrible when your computer keeps storing temporary files in a bulk.

By the end of this article, you’ll be able to clean temporary files on your computer:

Step #1: Type and open the “Windows Settings” from the Start menu or press the “Windows + I” key combination.

windows setting app in windows 11
Windows Settings App

Step #2: Select the “System” option from the left sidebar and click the “Storage” option.

click the storage option in system settings
Storage option

Step #3: Toggle on the “Storage Sense” button and configure it depending on your preferences.

toggle on the storage sense option
Toggle on the button

Read More: How To Enable and Configure Storage Sense

Step #1: Right-click the desktop and create a new “Text Document” (NotePad) file from the context menu or open the notepad app from the Start menu.

notepad app icon in windows 11
Notepad App Icon

Step #2: Type the following command and save the file in the desired location and exit:

del /s /f /q %userprofile%\Recent*.*
del /s /f /q C:\Windows\Prefetch*.*
del /s /f /q C:\Windows\Temp*.*

type the command in the notepad (txt file format) and save it
Type and Save

Step #3: Rename the file extension from “.txt” file extension to “.bat” (Batch File).

change file extension from txt to bat
Bat File Icon

Step #4: Run the file as an administrator and the command prompt will run for a few seconds and your temporary files will be automatically deleted.

You can use this method only if you’ve followed the steps in Method 2 above and created the batch file.

Step #1: Type and open the “Task Scheduler” app from the Start menu.

task scheduler app icon in windows 11
Task Scheduler App Icon

Step #2: Click the “Create Basic Task” option on the right sidebar.

select windows media player from the optional features in windows settings
“Create a Basic Task” option

Step #3: Add the task name and description (if any) and press the “Next” button.

add the task name and description
Task Name and Description

Step #4: Set the time when you want to initiate the task automatically and press the “Next” button.

choose the desired time when to run the task automatically
Choose when to run the task

Step #5: In the “Action” tab, select the “Start a program” option.

select the start a program option
“Start a Program” option

Step #6: In the “Start a Program” tab, add the file path where you saved the BAT File (in the previous method) and press the “Next” button.

press the browse button and choose the file location
Add the “BAT File” Path

Step #7: Recheck your configurations and press the “Finish” button to clean the temp files automatically (depending on your custom settings).

press the finish button to create and activate the task
Click the “Finish button”

Note: If the steps are correctly implemented, the scheduled task will work correctly. However, to delete the scheduled task, select the task name from the list of running tasks and click the “Delete” button on the right sidebar.

deleting the scheduled task
Deleting the Scheduled Task (if required)

is it safe to delete temp files?

Yes, deleting temporary files in Windows is completely safe. In some cases, you may be unable to remove a few files because you are not an administrator or because such files are being created, written, and stored by the opened programs. In this scenario, simply open the file as an administrator or close the opened programs and remove the temp files.

Next Steps

We’ve covered how to auto clean temp files on Windows. To remove the temp files automatically, you can use any of the methods that you find to be the most convenient and easy to follow along.

Improve your computer’s storage-related problems by following the related articles below.

Related Articles

how to remove windows old folder in windows 11

Remove Windows Old Folder

Clear 15-25 GB of storage by deleting a single unused file on your computer.

clear cache in windows 11

Clear Cache on Windows [Complete Guide]

Completely Clear Cache and save space on your computer.

how to check vram in windows 11

Check VRAM on Windows 11

VRAM plays a major role in terms of the device’s performance. Check whether or not your version of VRAM is compatible with your device.

Take a Minute to Share This Article.