🐍 Python 3.10+

Check "Disable Recent Documents History" Status (Python)

Reads the registry value behind the "Disable Recent Documents History" tweak via winreg to confirm whether it's applied.

By WindowsScripting.com · 686 B
check_disable_recent_docs_history_status.py
#!/usr/bin/env python3
"""
check_disable_recent_docs_history_status.py

Checks whether "Disable Recent Documents History" is currently applied.

Usage:
    python check_disable_recent_docs_history_status.py
"""

import winreg


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


if __name__ == "__main__":
    main()