Batch Scripts

Clear Shader Cache

Clear the graphics shader caches that build up for every game: a common fix for stutter, glitches and crashes after a driver update.

 

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

Games compile shaders, the small programs your graphics card runs, and Windows and your graphics driver save them in a cache so the next launch is faster. After a driver update or a game patch that cache can go stale or get corrupted, which shows up as stutter, flickering textures or crashes. Clearing it is a standard first fix.

This script empties the DirectX shader cache and the NVIDIA, AMD and Intel driver caches you tick, and shows how much space it freed. Nothing is broken by it: the next time you play, the game rebuilds the cache, so the first few minutes may stutter a little while that happens.

How to use Clear Shader Cache

  1. Untick any graphics brands you don't have (leaving them ticked is harmless).
  2. Download the script, close your games and double-click it.
  3. Start your game: the first few minutes may stutter slightly while shaders are rebuilt.

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
%LOCALAPPDATA%\D3DSCacheWindows' DirectX shader cache, the same one Disk Cleanup lists.
%LOCALAPPDATA%\NVIDIA\DXCache, GLCacheNVIDIA's DirectX and OpenGL/Vulkan caches.
%LOCALAPPDATA%\AMD\DxCache, VkCacheAMD's DirectX and Vulkan caches.
del /f /s /q … & rd /s /qDeletes the files and subfolders inside each cache, but keeps the folder itself.
Measure-Object Length -SumAdds up the cache size before and after, to show what was freed.

Clear Shader Cache FAQ

Is it safe?

Yes. These folders only hold caches that the driver and games rebuild automatically. No settings, saves or drivers are touched.

Some space wasn't freed.

Files in use stay, usually because a game, launcher or browser is still open. Close them and run it again.

Should I do this regularly?

No, only when you have stutter or glitches, or after a big driver update. A healthy cache makes games load faster.

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