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.
- Open Notepad.
- Copy-paste the script below into Notepad.
Del /S /F /Q %temp%
Del /S /F /Q %Windir%\Temp
- Save with any name but end in .bat (batch). For example
- Open the Group Policy Editor.
- Navigate to Computer Configuration > Windows Settings > Scripts > Shutdown.
- Then in the Properties window, click the Add option.
- Then select the Browser option, then find the script file that was created.
- Leave the column blank in the Script Parameters option. Click OK to save the settings.
- Click OK again to save the settings, as well as exit the Properties window.
A little explanation about the contents of the script:
- Deletes the temporary file from the User:
Del /S /F /Q %temp%.
- Deletes temporary files in Windows:
Del /S /F /Q %Windir%\Temp\.
After the process is complete, the system will clear the Windows cache automatically every time the computer is turned off.