Skip to content

Instantly share code, notes, and snippets.

@ahamilton9
Last active October 3, 2017 21:59
Show Gist options
  • Save ahamilton9/28f16456ffd2205aca8d9ace17fe8b03 to your computer and use it in GitHub Desktop.
Save ahamilton9/28f16456ffd2205aca8d9ace17fe8b03 to your computer and use it in GitHub Desktop.
Clear Icon and Thumbnail Caches for Windows 10
:: Put into .bat file, right click, Run as Administrator
:: Dev Notes:
:: @ Don't print this command
:: echo off Don't print any further commands, but leave their output
:: >nul Hide this command's output
:: &:: The command has ended ("&") and the rest of the line is a comment ("::")
@echo off
echo Close all other programs now, or risk losing data! Press any key to continue.
pause >nul
echo Killing Explorer...
taskkill /f /im explorer.exe &:: /f Force, /im Image Name (by name, not PID)
echo Waiting a few seconds for file locks to clear...
timeout 5 >nul
echo Heading to the cache directory...
cd %userprofile%\AppData\Local\Microsoft\Windows\Explorer
echo Clearing cache files...
del iconcache*
del thumbcache*
echo Restarting Explorer...
start explorer
echo Complete! Press any key to exit.
pause >nul
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment