🐍 Python 3.10+

Increase Icon Cache Size (Python)

Raises the icon cache limit, useful on machines with huge numbers of shortcuts. Applies the tweak via the stdlib winreg module.

By WindowsScripting.com · 576 B
set_increase_icon_cache_size.py
#!/usr/bin/env python3
"""
set_increase_icon_cache_size.py

Increase Icon Cache Size.
Raises the icon cache limit, useful on machines with huge numbers of shortcuts.

Usage:
    python set_increase_icon_cache_size.py
"""

import winreg


def main() -> None:
    key = winreg.CreateKeyEx(
        winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Windows\Explorer", 0, winreg.KEY_SET_VALUE
    )
    winreg.SetValueEx(key, "Max Cached Icons", 0, winreg.REG_SZ, "4096")
    winreg.CloseKey(key)
    print("Increase Icon Cache Size applied.")


if __name__ == "__main__":
    main()