Batch Scripts

Clear Discord Cache

Discord's cache of images, videos and app code can grow to gigabytes. Clear it safely, without logging you out.

 

Windows only. Read the code before running any script you download. Your browser or Windows SmartScreen may warn about .bat files; choose "Keep" / "More info › Run anyway" if you trust it.

Keeps this tool on this device so it works without internet, even after a refresh.

Had fun, or did this help? I’d appreciate any donation :) Not needed, but money buys temporary happiness at least lol

What it does

Every image, GIF, video and emoji you scroll past in Discord is saved in a cache so it loads faster next time. Over months this can grow to several gigabytes, and a corrupted cache is also behind many "Discord won't load", grey screen and broken image problems.

This script closes Discord (optional), empties its Cache, Code Cache and GPU Cache folders for the normal, PTB and Canary versions, shows how much space was freed, and opens Discord again. It leaves your login and settings alone, so you stay logged in.

How to use Clear Discord Cache

  1. Leave "Close Discord first" ticked so every file can be cleared.
  2. Download the script and double-click it. Discord closes, the cache is cleared and Discord opens again.

Making the .bat file yourself

The download button already gives you a ready-to-run .bat file. If you'd rather copy the code, or the download gets blocked, you can make the file yourself in Notepad:

  1. Click Copy code, open Notepad and paste.
  2. Choose File › Save as. Set Save as type to All files (*.*). This step matters: if it stays on "Text documents", Notepad quietly adds .txt.
  3. Type a name ending in .bat, like my-script.bat, and save. You can also type the name in quotes, "my-script.bat", which forces that exact name even on "Text documents".
  4. Check the file's icon: a .bat file shows a gear-window icon, not a notepad page. Double-click it to run.
My file ended up as script.bat.txt and opens in Notepad. How do I fix it?

Windows hides file extensions by default, so the file looks like script.bat but is really script.bat.txt. Turn extensions on: in File Explorer, choose View › Show › File name extensions (Windows 11) or tick File name extensions on the View tab (Windows 10). Then rename the file, delete the .txt at the end, and click Yes when Windows asks if you're sure you want to change the extension.

How it works

CommandWhat it does
taskkill /f /im Discord.exeCloses Discord so its cache files aren't locked.
%APPDATA%\discord\Cache, Code Cache, GPUCacheWhere Discord keeps cached media, app code and graphics data. Login and settings live elsewhere and aren't touched.
discordptb, discordcanaryThe test versions of Discord, cleared too if you have them.
Update.exe --processStart Discord.exeHow Discord's own shortcut starts it.

Clear Discord Cache FAQ

Will I be logged out?

No. Your login is stored in Discord's Local Storage folder, which this script doesn't touch.

The cache filled up again.

That's normal: it rebuilds as you use Discord. Run the script whenever it gets big or Discord acts up.

Does it delete my messages or files?

No. Messages and uploads live on Discord's servers. Only local copies used to load things faster are removed.

How do I run a .bat file?

Double-click it. To see or edit the code, right-click it and choose Edit (or open it in Notepad). Scripts that need administrator rights say so; for those, right-click › Run as administrator.

Is this script uploaded or tracked?

No. The code is built in your browser from the settings above and downloaded straight to your PC.

Related