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.
- 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. - Still in Windows start your Notepad app and make a new ‘note’.
- 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. - 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…