🐍 Python 3.10+

Check "Show Recycle Bin Icon on Desktop" Status (Python)

Reads the registry value behind the "Show Recycle Bin Icon on Desktop" tweak via winreg to confirm whether it's applied.

By WindowsScripting.com · 765 B
check_show_recycle_bin_on_desktop_status.py
#!/usr/bin/env python3
"""
check_show_recycle_bin_on_desktop_status.py

Checks whether "Show Recycle Bin Icon on Desktop" is currently applied.

Usage:
    python check_show_recycle_bin_on_desktop_status.py
"""

import winreg


def main() -> None:
    try:
        key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel")
        value, _ = winreg.QueryValueEx(key, "{645FF040-5081-101B-9F08-00AA002F954E}")
        winreg.CloseKey(key)
        print(f"Current value of '{645FF040-5081-101B-9F08-00AA002F954E}': {value}")
    except FileNotFoundError:
        print("'{645FF040-5081-101B-9F08-00AA002F954E}' is not set (using the Windows default).")


if __name__ == "__main__":
    main()