Clean all relevant caches in 1 click? Yes!

Hi all,

Are you also tired of cleaning your caches and finding them and clicking until you get the feeling of RSI? Well that’s over. I was convinced this could be automated. So I made and tested a script which does all that. You will have to make a few prerequisites in order to make it work.

  1. In Windows (I assume you are on Windows) press Win. In the searchbox on top type CMD. You can now choose to start CMD but you first need to right-click and select start as Administrator. Type the following: cleanmgr.exe sageset:1 and hit enter. Now your standard Disk Clean dialog will open. Deselect all boxes and only select DirectX Shader-cache. Click Ok. Perform the same action for all drives relevant to MSFS. Now your Registry is ready for the following command which we will incorporate in our little script.
  2. Still in Windows start your Notepad app and make a new ‘note’.
  3. Paste the following line in there first: "cleanmgr.exe sagerun:1" This command will automatically start your DiskClean utility for all drives and only clean your DirectX Shader-cache. Presto. But we´re not done yet.
  4. Paste the following lines after step 3 in the script:
    CD C:\Users\Admin\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\SceneryIndexes DEL /Q /F *.* rmdir /s /q "C:\Users\Admin\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\SceneryIndexes\" CD C:\Users\Admin\AppData\Local\NVIDIA\GLCache DEL /Q /F *.* rmdir /s /q "C:\Users\Admin\AppData\Local\NVIDIA\GLCache\" CD C:\Users\Admin\AppData\LocalLow\NVIDIA\PerDriverVersion\DXCache DEL /Q /F *.* rmdir /s /q "C:\Users\Admin\AppData\LocalLow\NVIDIA\PerDriverVersion\DXCache\" CD C:\Users\Admin\AppData\Roaming\NVIDIA\ComputeCache DEL /Q /F *.* rmdir /s /q "C:\Users\Admin\AppData\Roaming\NVIDIA\ComputeCache\" ECHO All caches deleted!

Of course you need to know where your caches are on your system. And under which username your admin rights are stored. But you can figure this out on your own. Oh and yes my MSFS copy is bought in the MS-Store. Not on Steam. Paths on Steam are different. But altering these paths shouldn’t be an issue either.

Save the script as something like “clean-all-caches.cmd”

Now for the Windows fun-part. The script should be run as Admin. How do we do that? I use Windows TaskScheduler for this. Start your Windows TaskScheduler as follows. Hit the Win key and enter in the searchbox on top “task”. Directly beneath you are presented with the Windows Task Scheduler(WTS). In WTS select ‘make task’ right on top. Enter a name for the new task, something like ‘clean-all-caches’. Also (important!) select the tick box ‘Run with highest priviliges’! Select the tab ´Actions´ and select ´new´ below. Now select browse for your saved “clean-all-caches.cmd” file. Click ok twice. You return in the main window. Select and copy the name you gave to your newly made ´task´. Now we can finalize our work.

Make a short cut with the following name C:\Windows\System32\schtasks.exe /run /tn "clean-all-caches" The name we made for out Task earlier. Click ok and you are all set to go. Execute the task which will execute your script as Admin and all your caches are emptied in one Go!

Have fun experimenting…

4 Likes

Excellent! Thank you.

1 Like

Hello @SandmanX1559

Thank you for your post! Your topic has been moved to the Tools & Utilities sub-category of the Discussion Hub

The General Discussion category is meant for discussions that fall outside of our other sub-categories.

If you would like to discuss other products and features in the sim, consider the following Discussion Hub categories:

Aircraft
Activities
Airports
Home Cockpit Builders
MSFS 2024
Real-life Aviation
Tools & Utilities
World Discovery

1 Like

You play this game on OS admin account?!

1 Like

Always! :smile: Better safe then sorry…

Safe is probably the last word I would use to describe this:). :slight_smile:

Hi how would you describe it?

Use the following script to clean your cache Corsten´s cache & shader removal tool for Microsoft Flight Simulator | MSFS

Haha, way to easy. Build your own I like to say. Thanks anyways buddy :smile:

By the way. I now notice these are all separate scripts. Mine is a only 1 click solution. Just sharing my thoughts about it.