🐍 Python 3.10+

Show Recycle Bin Icon on Desktop (Python)

Adds the Recycle Bin icon back to the desktop. Applies the tweak via the stdlib winreg module.

By WindowsScripting.com · 631 B
set_show_recycle_bin_on_desktop.py
#!/usr/bin/env python3
"""
set_show_recycle_bin_on_desktop.py

Show Recycle Bin Icon on Desktop.
Adds the Recycle Bin icon back to the desktop.

Usage:
    python set_show_recycle_bin_on_desktop.py
"""

import winreg


def main() -> None:
    key = winreg.CreateKeyEx(
        winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel", 0, winreg.KEY_SET_VALUE
    )
    winreg.SetValueEx(key, "{645FF040-5081-101B-9F08-00AA002F954E}", 0, winreg.REG_DWORD, 0)
    winreg.CloseKey(key)
    print("Show Recycle Bin Icon on Desktop applied.")


if __name__ == "__main__":
    main()