How to Automatically Clear Windows Cache when Shutdown

Works on all Windows version

Clear Windows cache can indeed be one option that could be taken when wanting to restore almost full storage space. This cache is a temporary file that is commonly used by systems and programs that are running.

To delete temporary files, you can use the Disk Cleanup tool. But if you feel it is quite troublesome, then you can make the process automatically.

Automatically Clear Windows Cache when Shutdown

Unfortunately, there are no settings where you can clear the Windows cache automatically. Therefore, you need to utilize scripts that are executed automatically when Windows shuts down. We test this using Windows 10 Pro.

  1. Open Notepad.
  2. Copy-paste the script below into Notepad.
Del /S /F /Q %temp%
Del /S /F /Q %Windir%\Temp
  1. Save with any name but end in .bat (batch). For example deltemp.bat.
  1. Open the Group Policy Editor.
  2. Navigate to Computer Configuration > Windows Settings > Scripts > Shutdown.
  3. Then in the Properties window, click the Add option.
  1. Then select the Browser option, then find the script file that was created.
  1. Leave the column blank in the Script Parameters option. Click OK to save the settings.
  1. Click OK again to save the settings, as well as exit the Properties window.
  2. Done.

A little explanation about the contents of the script:

After the process is complete, the system will clear the Windows cache automatically every time the computer is turned off.

Exit mobile version
Skip to toolbar