🐍 Python 3.10+

Check "Enable Clipboard History" Status (Python)

Reads the registry value behind the "Enable Clipboard History" tweak via winreg to confirm whether it's applied.

By WindowsScripting.com · 650 B
check_enable_clipboard_history_status.py
#!/usr/bin/env python3
"""
check_enable_clipboard_history_status.py

Checks whether "Enable Clipboard History" is currently applied.

Usage:
    python check_enable_clipboard_history_status.py
"""

import winreg


def main() -> None:
    try:
        key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Clipboard")
        value, _ = winreg.QueryValueEx(key, "EnableClipboardHistory")
        winreg.CloseKey(key)
        print(f"Current value of 'EnableClipboardHistory': {value}")
    except FileNotFoundError:
        print("'EnableClipboardHistory' is not set (using the Windows default).")


if __name__ == "__main__":
    main()