How to Automatically Delete Temporary Files on Windows 11
Windows 11 stores a large amount of temporary files over time, which causes some effects such as slow computer operation, unresponsive applications, etc. To free up space for your computer and speed up your computer, you should check and delete some temporary Windows folders or set up to delete temporary files on Windows 11, according to the instructions below.
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.

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

At Name we enter Clear Temporary Files then click Next to continue.
Step 3:
Users select the frequency they want to delete temporary files on their computer and click Next to proceed.
Next select the start time that this task will take place and click Next to continue.
Step 4:
The user selects Start a Program and then clicks Next below to continue.
In the Program/Script field , click the Browse button and select the bat file you saved earlier.
Step 5:
Switch to the new interface, we click on Open the Properties Dialog For This Task When I click Finish and click Finish to execute.
In the new dialog box interface, select Run With Highest Privileges and click OK to complete.
Step 6:
The above script only deletes temporary files on Windows 11. If you want to delete other files, add the following extensions to the script below.
To make your script delete the contents of the Trash as well , add the following 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 the following code:
del /s /f /q C:WindowsPrefetch*.* >nul 2>&1
You should read it
- Automatically delete temporary files every time a Windows 10 computer is opened
- Free up space on Windows 10 by deleting temporary files
- What is Temporary File? How to delete temporary files on windows computers
- How to Delete Temporary Files in Windows 7
- Free up hard drive space automatically on Windows 10 with Disk Cleanup
- Automatically 'clean up' the Recycle Bin on Windows 10
- Automatically frees free space on Windows 10 after 30 days
- How to Clear Temp Files in Windows 10
- How to Delete Temporary Files and Delete Prefetch Files from Your Computer
- Steps to remove temporary files stored on Kaspersky
- Instructions for sharing temporary files on DoShare
- Delete junk files, temporary files in Windows
Maybe you are interested
How to fix Bluetooth Metered Connection error on Windows 10 This portable electric chair can reach speeds of 40km / h Hackers attacked hundreds of universities to gain access to library data Trick to start and shut down Windows Server 2012 computer in a blink of an eye Iranian Siemens continued to sabotage the nuclear plant Spy virus attacks the Iranian Government