Category filter

Script to clear cache and temporary files on Windows devices

Clearing all caches in Windows usually helps if your device is slowing down or exhibiting suboptimal performance. This usually happens when you’ve been on the internet for a while, installed Windows updates, or haven’t reset your computer in a long time.

For several reasons, clearing your cache regularly enhances the efficiency of your system. Depending on your settings, a cache can get rather large and take up a lot of disc space on your computer. The more data saved in the cache, the slower your computer will browse the web or do routine tasks. Delete the cache data to aid debugging, improve web page loading times, and boost your computer’s performance.

Using Hexnode, you can deploy scripts to effortlessly delete all temporary files and directories as well as empty the recycle bin.

Disclaimer:

The sample scripts provided below are adapted from third-party open-source sites.

PowerShell scripts

1) Remove temporary files

2) Clear Recycle Bin

Batch script

Notes:

  • Once the script is run successfully, restart your device for the changes to take effect.
  • Windows do not allow any files or folders that are still in use to be deleted.
  • It is recommended to manually validate the script execution on a system before executing the action in bulk.
  • Hexnode will not be responsible for any damage/loss to the system on the behavior of the script.

  • Sample Script Repository