Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

How to Automatically Delete Temporary Files on Windows 11

Learn how to automatically delete temporary files on Windows 11 with clear steps, practical tips, and troubleshooting guidance for common issues.

Table of Contents

This updated guide explains how to automatically delete temporary files on Windows 11 with clear steps, practical tips, and useful context. Windows 11 stores a large amount of temporary files over time, which causes some effects such as slow computer operation, unresponsive applications, etc.

Instructions to Automatically Delete Temporary Files Windows 11

Step 1:

First we proceed to create a command to delete temporary files from the user account's temporary folder as well as the system-wide temporary folder.

Open Notepad and enter the command below.

@echo off echo Cleaning system and user temp files. del /s /f /q %TEMP%*.* >nul 2>&1 rd /s /q %TEMP% >nul 2>&1 md %TEMP% del /s /f /q C:WindowsTemp*.* >nul 2>&1 rd /s /q C:WindowsTemp >nul 2>&1 md C:WindowsTemp echo Temporary files cleared!

In the save interface, enter ClearTempFiles.bat in File name and press Save.

Instructions to automatically delete temporary files Windows 11 - Automatically Delete Temporary Files on Windows 11

Step 2:

Then the user opens Task Scheduler and clicks Create Basic Task to create a new task.

Instructions to automatically delete temporary files Windows 11 example 2

At Name we enter Clear Temporary Files then choose Next to continue.

Instructions to automatically delete temporary files Windows 11 example 3

Step 3:

Users select the frequency they want to delete temporary files on their computer and choose Next to proceed.

Instructions to automatically delete temporary files Windows 11 example 4

Next select the start time that this task will take place and choose Next to continue.

Instructions to automatically delete temporary files Windows 11 example 5

Step 4:

The user selects Start a Program and then clicks Next below to continue.

Instructions to automatically delete temporary files Windows 11 example 6

In the Program/Script field , choose the Browse button and select the bat file you saved earlier.

Instructions to automatically delete temporary files Windows 11 example 7

Step 5:

Switch to the new interface, we select Open the Properties Dialog For This Task When I choose Finish and choose Finish to execute.

In the new dialog box interface, select Run With Highest Privileges and choose OK to complete.

Instructions to automatically delete temporary files Windows 11 example 8

Step 6:

The above script only deletes temporary files on Windows 11. to delete other files, add these extensions to the script below.

To make your script delete the contents of the Trash as well , add these command.

PowerShell.exe -Command "Clear-RecycleBin -Force"

To clear the Windows Update cache , enter the command below.

net stop wuauserv rd /s /q C:WindowsSoftwareDistributionDownload net start wuauserv

You can delete pretech files using these code:

del /s /f /q C:WindowsPrefetch*.* >nul 2>&1

FAQ

What should I prepare before I automatically delete temporary files on windows 11?

Review the requirements and options in the guide first. Having the correct device, app version, account access, or materials ready helps prevent avoidable errors.

How long does it take to automatically delete temporary files on windows 11?

The time depends on the task and your setup. Most basic steps can be completed quickly, while downloads, updates, scans, or troubleshooting may take longer.

What should I do if the steps do not work?

Repeat the instructions in order, confirm that your software or device is supported, and check permissions, connectivity, and available updates before trying again.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.