As you may already know, Windows 10 includes the ability to automatically delete files in your Recycle bin, delete temporary files, and files in the Downloads folder to free up disk space. In recent Windows 10 builds, Storage Sense can automatically delete temporary files for your user account. Here is how to change its options.
Temporary files are created by various Windows services, installed apps and tools. Temporary files can be safely deleted after the process which has created them has quit. However, this does not happen often, so the system temporary directory or the app's temp directory continues to store them and fills your disk drive with junk. When this option is enabled, Windows will delete them automatically and keep you drive clean besides saving your disk space.
Storage Sense is a nice, modern replacement for Disk Cleanup. It allows you to maintain certain folders by preventing them from getting too large and clean them up automatically. The Storage Sense feature can be found in Settings, under System -> Storage.
Storage Sense can be used to remove Windows upgrade log files, system-created Windows Error Reporting Files, Windows Defender Antivirus temporary files, Thumbnails, Temporary Internet Files, Device driver packages, DirectX Shader Cache, Downloaded Program Files, Delivery Optimization Files, old System log files, System error memory dump files and minidumps, temporary Windows update files, and more.
While you can clear the %temp% folder manually (references: article #1, article #2, article #3), you can automate this process using Storage Sense. This feature is enabled by default in WIndows 10. Here is how to disable or re-enable it.
Disable Storage Sense to Delete Temporary Files in Windows 10
- Open Settings.
- Go to System - Storage.
- Turn on the Storage sense option on the right.
- On the right, click on the Configure Storage Sense or run it now link.
- On the next page, navigate to the Temporary files section.
- Turn off (uncheck) the option Delete temporary files that my apps aren't using.
You can re-enable the feature by turning on the check box Delete temporary files that my apps aren't using at any moment.
Alternatively, you can apply a Registry tweak to enable or disable this option.
Prevent Storage Sense from Deleting Temporary Files with a Registry Tweak
- Open the Registry Editor app.
- Go to the following Registry key.
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy
See how to go to a Registry key with one click.
- On the right, modify or create a new 32-Bit DWORD value 04.
Note: Even if you are running 64-bit Windows you must still create a 32-bit DWORD value.
Set its value to 0 to disable the feature. A value data of 1 will enable it. - To make the changes done by the Registry tweak take effect, you need to sign out and sign in to your user account.
You can download the following ready-to-use Registry files.
The undo tweak is included.
Finally, you can use Local Group Policy.
Disable Storage Sense to Delete Temporary Files with Local Group Policy
If you are running Windows 10 Pro, Enterprise, or Education edition, you can use the Local Group Policy Editor app to force disable or enable the Delete Temporary Files feature for all users. The policy is available starting in Windows 10 Build 18282. See How to find the Windows 10 build number you are running.
Here is how.
- Press Win + R keys together on your keyboard and type:
gpedit.msc
- Group Policy Editor will open. Go to Computer Configuration\Administrative Templates\System\Storage Sense. Enable the policy option Allow Storage Sense Temporary Files cleanup.
- Set it to Enabled to make it always enabled for all users.
- Set it to Disable to keep it always disabled for all users.
- The default (Not Configured) state will allow users to change the options using the Settings app.
If your Windows 10 edition doesn't come with the Local Group Policy Editor app, you can apply a Registry tweak instead.
Configure the policy option with a Registry tweak
- Open Registry Editor.
- Go to the following Registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\StorageSense
Tip: See how to jump to the desired Registry key with one click.
If you do not have such a key, then just create it.
- Here, create a new 32-bit DWORD value AllowStorageSenseTemporaryFilesCleanup. Note: Even if you are running 64-bit Windows, you still need to use a 32-bit DWORD as the value type.
Set it to 0 to force disable the feature for all users. A value data of 1 will forcibly enable it for all users. - To make the changes done by the Registry tweak take effect, you need to Restart Windows 10.
Later, you can delete the AllowStorageSenseTemporaryFilesCleanup value to cancel the restriction. Don't forget to restart the OS after that.
You can download the following ready-to-use Registry files.
The Group Policy-related files are under the Group Policy folder in the ZIP archive.
That's it.
Support us
Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:
I for one will never trust M$ to choose what files to keep or not keep on my PC.