🐍 Python 3.10+

Check "Show This PC Icon on Desktop" Status (Python)

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

By WindowsScripting.com · 755 B
check_show_this_p_c_on_desktop_status.py
#!/usr/bin/env python3
"""
check_show_this_p_c_on_desktop_status.py

Checks whether "Show This PC Icon on Desktop" is currently applied.

Usage:
    python check_show_this_p_c_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, "{20D04FE0-3AEA-1069-A2D8-08002B30309D}")
        winreg.CloseKey(key)
        print(f"Current value of '{20D04FE0-3AEA-1069-A2D8-08002B30309D}': {value}")
    except FileNotFoundError:
        print("'{20D04FE0-3AEA-1069-A2D8-08002B30309D}' is not set (using the Windows default).")


if __name__ == "__main__":
    main()