' ============================================================
' SetIncreaseIconCacheSize.vbs
'
' Increase Icon Cache Size.
' Raises the icon cache limit, useful on machines with huge numbers of shortcuts.
'
' Usage: cscript SetIncreaseIconCacheSize.vbs
' ============================================================

Option Explicit

Dim objShell
Set objShell = CreateObject("WScript.Shell")

On Error Resume Next
objShell.RegWrite "HKCU\Software\Microsoft\Windows\Explorer\Max Cached Icons", "4096", "REG_SZ"

If Err.Number = 0 Then
    WScript.Echo "Increase Icon Cache Size applied."
Else
    WScript.Echo "Failed to apply tweak (Error " & Err.Number & ": " & Err.Description & ")"
End If
On Error Goto 0