How to Delete Temporary Files on Windows 10?

A large number of temporary files are created on Windows, which are not always deleted automatically and over time take up more and more disk space. In this article, we will look at how to effectively delete temporary files in Windows 10.

Delete Temporary Files on Windows 10 Using Storage

In modern Windows 10 builds, you can quickly delete temporary files from the Settings menu. Press Win + I and go to System > Storage. In our example, Windows shows that there are about 2.4 GB of temporary files on the disk.

delete temp files windows 10

Click on the Temporary files icon. In the window that opens, the Cleanup Wizard will run and show how much space can be cleaned up due to temporary files. It is proposed to clean up temporary files for the following components:

  • Windows Update Cleanup;
  • Downloads;
  • Windows upgrade log files;
  • Recycle Bin;
  • Thumbnails;
  • Windows Defender Antivirus;
  • Temporary Windows installation files;
  • Delivery Optimization Files;
  • Temporary Files;
  • System error minidump files;
  • Temporary Internet Files;
  • DirectX Shader Cache.

Select the features you want to cleanup and click the Remove Files button.

delete temporary files on windows 10

Disk Cleanup Tool in Windows 10

In Windows 10, as in previous versions of Windows, there is a built-in Disk Cleanup manager. To start it press the key combination Win + R > type cleanmgr > hit Enter.

delete temporary files windows 10

By default, Disk Cleanup tool offers to clear only temporary files of the current user. To delete temporary system files, click the Cleanup system files button (you will need to specify administrator credentials after showing UAC prompt).

remove temp files windows 10

Select the files you want to delete and click OK.

Clean up Temp Files with Scripts

You can also manually clean the following directories, which are used by most applications and Windows 10 itself:

  • C:/Windows/Temp
  • C:/Users/%UserName%/AppData/Local/Temp
  • C:/Users/%UserName%/AppData/Local/Microsoft/Windows/Temporary Internet Files

You can create a simple batch script that removes all files older than 14 days from temporary directories. Create a text file cleanuptemp.bat with the following code:

SET Path1Del=C:/Windows/Temp

SET Path2Del="C:/Users/%UserName%/AppDataLocal/Microsoft/Windows/Temporary Internet Files"

forfiles.exe /p %temp% /s /m *.* /d -14 /c "cmd /c del /q /f @file"

forfiles.exe /p %Path1Del% /s /m *.* /d -14 /c "cmd /c del /q /f @file"

forfiles.exe /p %Path2Del% /s /m *.* /d -14 /c "cmd /c del /q /f @file"

remove temporary files windows 10

Run the bat file with administrator privileges.


Hint. You can also use the following PowerShell script to automatically delete files older than 14 days from temporary folders:

$Path = "C:/Windows/Temp"

$Days = "-14"

$CurrentDate = Get-Date

$OldDate = $CurrentDate.AddDays($Days)

Get-ChildItem $Path -Recurse | Where-Object { $_.LastWriteTime -lt $OldDate } | Remove-Item -force

To automatically clean up temporary files once a week, you can create the following task in the Task Scheduler.

Schtasks.exe /Create /RL Highest /TN CleanUpTemp /SC Weekly /D SUN /ST 20:00 /TR "C:/PS/cleanuptemp.bat"
I enjoy technology and developing websites. Since 2012 I'm running a few of my own websites, and share useful content on gadgets, PC administration and website promotion.
Latest posts by Cyril Kardashevsky (see all)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.