W8 keeps deleting thumbnail cache (changed folder permission)

I use it daily. I also wrote a script to backup the thumbnails, because I was getting tired of manually opening the location.
 

My Computer

System One

  • OS
    Arch x64 / Windows 8.1 Pro x64
Also, excuse my ignorance, but what do you do with copy of the thumbnail folder that you create before shutting down?

Also, thanks for sharing your expertise!
 

My Computer

System One

  • OS
    WIn 8.1 x64
I'm not sure what you mean by that, but this one creates the backups for the other script to restore on startup:

Code:
@echo off

:: Go to C:\Users\<Name>\AppData\Local\Microsoft\Windows\
cd %LocalAppData%\Microsoft\Windows\

:: Remove previous "Explorer - Copy" backup (2>nul: ignore directory doesn't exist)
rd "Explorer - Copy" /s/q 2>nul

:: Create new one (echo d: copy a directory)
echo d | xcopy Explorer "Explorer - Copy" /y/s/q

When you run it right before shutting down, you preserve all the additional thumbnails created on that boot.
 

My Computer

System One

  • OS
    Arch x64 / Windows 8.1 Pro x64
Thank you! It may be moot with your script, but I what I was asking earlier was where do you save the copy of the thumbnail folder that you create? In the same directory as the original?
 

My Computer

System One

  • OS
    WIn 8.1 x64
Ah, yes. As "Explorer - Copy", as that's the default naming you get with Explorer, and I wanted to preserve that.

Both located in "%LocalAppData%\Microsoft\Windows" (C:\Users\<name>\AppData\Local\Microsoft\Windows).
 

My Computer

System One

  • OS
    Arch x64 / Windows 8.1 Pro x64
Hi Det87, I was wondering if your method can salvage reset thumbnails? What I mean is that for example, I restarted my computer, all my thumbnails are copied somewhere. In the middle of the day, the thumbnail cache reset for still-unknown reasons. Now, if I want to rebuild the thumbnail cache without opening every folder, do I just restart my computer and let it rebuild the cache from the copied thumbnail file at startup? Is that correct? That's my understanding of how your script works, thank you.
 

My Computer

System One

  • OS
    Windows 8.1
I'll try to explain this a bit better. When the specific thumbnail databases exceed the allotted size (I think something like 50MB), they are moved to the ThumbCacheToDelete subfolder as "thmXXXX.tmp", and new empty .db's are created in their place. When the system boots up, the ThumbCacheToDelete ​folder is removed.

Here's an overview of the location (C:\Users\<name>\AppData\Local\Microsoft\Windows\Explorer or %LocalAppData%\Microsoft\Windows\Explorer):

Untitled.jpg

My backup script essentially does the same as going to C:\Users\<name>\AppData\Local\Microsoft\Windows and copy+pasting the Explorer folder in the same directory (resulting in Explorer - Copy):

Code:
@echo off

:: Go to C:\Users\<Name>\AppData\Local\Microsoft\Windows\
cd %LocalAppData%\Microsoft\Windows\

:: Remove previous "Explorer - Copy" backup (2>nul: ignore directory doesn't exist)
rd "Explorer - Copy" /s/q 2>nul

:: Create new one (echo d: copy a directory)
echo d | xcopy Explorer "Explorer - Copy" /y/s/q

The restoration script kills explorer.exe to remove the locks from the thumbnails, restores them from Explorer - Copy, and restarts explorer.exe:

Code:
@echo off

:: Go to C:\Users\<Name>\AppData\Local\Microsoft\Windows\
cd %LocalAppData%\Microsoft\Windows\

:: Kill explorer.exe
taskkill /im explorer.exe /f

:: Copy thumbnails from "Explorer - Copy"
xcopy "Explorer - Copy\thumbcache_*.*" "Explorer\" /q/y

:: Restart explorer.exe with "start" to auto-close CMD window
start explorer.exe

Attachments below:
 

Attachments

  • Backup Thumbnails.bat
    328 bytes · Views: 309
  • Restore Thumbnails.bat
    351 bytes · Views: 299

My Computer

System One

  • OS
    Arch x64 / Windows 8.1 Pro x64
OK that makes sense. So essentially, I run the backup.bat to make the "explorer - copy" folder that has the cache at that moment, and run restore.bat to replace the content of the "explorer" folder with whatever was in the "explorer - copy" folder. So if for some reason my cache in explorer folder gets reset for whatever reason, I can just run the restore.bat to repopulate the cache with the backup.
 

My Computer

System One

  • OS
    Windows 8.1
Det87's fix works great! I've been using it for two weeks, never have to wait for thumbnails to reload. Thanks again, Det87!
 

My Computer

System One

  • OS
    WIn 8.1 x64
For anyone (with a Pro copy of 8) wanting to automate the use of these scripts:
1. Run gpedit.msc
2. Computer Configuration>Windows Settings>Scripts (Startup/Shutdown)>Startup
3. Add
4. Script Name: %windir%\system32\cmd.exe
Script Parameters: /c "%localappdata%\Microsoft\Windows\Restore Thumbnails.bat"
(<-- Replace with the location of your "Restore Thumbnails.bat", quotes needed for filepaths with spaces)
5. OK

Repeat for Shutdown and "Backup Thumbnails.bat"
 

My Computer

System One

  • OS
    Windows 8.1 Pro x64 Update 1
    Computer type
    Laptop
    System Manufacturer/Model
    Samsung Series 5 Ultrabook - NP540U3C-A03UB
    CPU
    Intel Core i5-3317U
    Memory
    8GB
    Graphics Card(s)
    Intel HD Graphics 4000
    Screen Resolution
    1366x768
    Hard Drives
    Samsung SSD 840 EVO 1TB
    Browser
    Google Chrome Canary
I'll try to explain this a bit better. When the specific thumbnail databases exceed the allotted size (I think something like 50MB), they are moved to the ThumbCacheToDelete subfolder as "thmXXXX.tmp", and new empty .db's are created in their place. When the system boots up, the ThumbCacheToDelete ​folder is removed.

Here's an overview of the location (C:\Users\<name>\AppData\Local\Microsoft\Windows\Explorer or %LocalAppData%\Microsoft\Windows\Explorer):

View attachment 47416

My backup script essentially does the same as going to C:\Users\<name>\AppData\Local\Microsoft\Windows and copy+pasting the Explorer folder in the same directory (resulting in Explorer - Copy):

Code:
@echo off

:: Go to C:\Users\<Name>\AppData\Local\Microsoft\Windows\
cd %LocalAppData%\Microsoft\Windows\

:: Remove previous "Explorer - Copy" backup (2>nul: ignore directory doesn't exist)
rd "Explorer - Copy" /s/q 2>nul

:: Create new one (echo d: copy a directory)
echo d | xcopy Explorer "Explorer - Copy" /y/s/q

The restoration script kills explorer.exe to remove the locks from the thumbnails, restores them from Explorer - Copy, and restarts explorer.exe:

Code:
@echo off

:: Go to C:\Users\<Name>\AppData\Local\Microsoft\Windows\
cd %LocalAppData%\Microsoft\Windows\

:: Kill explorer.exe
taskkill /im explorer.exe /f

:: Copy thumbnails from "Explorer - Copy"
xcopy "Explorer - Copy\thumbcache_*.*" "Explorer\" /q/y

:: Restart explorer.exe with "start" to auto-close CMD window
start explorer.exe

Attachments below:

Your scripts don't seem to work for me. The "Backup Thumbnails.bat" says "File not found - Explorer" when I run it, and the "Restore Thumbnails.bat" successfully kills and restarts "Explorer" but none of the files from "Explorer - Copy" are pasted into "Explorer". Copying and pasting the scripts directly into CMD works though.

I tried replacing "<Name>" with "BR4DDERS" as well but that didn't work.

Any help would be appreciated.
 

My Computer

System One

  • OS
    Windows 8.1 Update 1
Well, the lines beginning with "::" are simply comments, and the actual work is below them, but I take it you're not using Windows 8?

If you are, then, for some reason, you don't have the Explorer folder in %LocalAppData%\Microsoft\Windows\ (C:\Users\BR4DDERS\AppData\Local\Microsoft\Windows\).
 

My Computer

System One

  • OS
    Arch x64 / Windows 8.1 Pro x64
@Det87

....... is it necessary to apply the Folder Permissions suggested by David Bailey before using the scripts, or is it good to go with just using the scripts ?
 

My Computer

System One

  • OS
    Windows 8.1 Pro x64
    Computer type
    Laptop
No, they don't do anything on W8, and might actually prevent the scripts from working (although temporarily).
 

My Computer

System One

  • OS
    Arch x64 / Windows 8.1 Pro x64
@Det87

....... thanks a lot for these 2 very useful scripts you wrote !!!

Before your reply I tried it already with having the "Folder Permissions" set to their default values and and it seems to work.

The only thing I haven't tried is to enable the "Automated Maintenance Tasks" again - Does it make a difference if they're enabled or not ?

I converted the Backup Thumbnails.bat to Backup Thumbnails.exe and have it run automatically on shutdown, same goes for the Restore Thumbnails.bat and as an .exe it doesn't give me the blue screen after startup.

Thumbnail Cache is now at about 350 MB and hopefully everything will be fine when I really go to increase it.

I'll let you guys know in a week or two.

This is going on for years now and you're the 1st who came up with an acceptable solution.

Great work and thanks again for sharing .......

Edit:
....... blue screen still appears, but it doesn't interrupt the "Metro Start Screen", it just flashes for a split second when changing from Metro to Desktop.

Hope it keeps working like this in the future .......
 
Last edited:

My Computer

System One

  • OS
    Windows 8.1 Pro x64
    Computer type
    Laptop
@tommygun

Changing folder permissions and disabling automatic maintenance didn't do anything for me. Changing those parameters might seem to work only because it isn't time for Windows to clear out the cache yet. So it'll look like it's working for the first couple of days. Det87's scripts are the only ones that work. Also, I would against running the scripts automatically. Let's say your computer has cleared out the cache and you want to restart. On shutdown the backup script will actually backup your "explorer" folder that's just been cleared. So now if you run the restore script on startup, you will restore your "explorer" folder with nothing. I suggest running the scripts manually.
 

My Computer

System One

  • OS
    Windows 8.1
Back
Top