🐍 Python 3.10+

Check "Show Seconds in Taskbar Clock" Status (Python)

Reads the registry value behind the "Show Seconds in Taskbar Clock" tweak via winreg to confirm whether it's applied.

By WindowsScripting.com · 702 B
check_show_seconds_in_taskbar_clock_status.py
#!/usr/bin/env python3
"""
check_show_seconds_in_taskbar_clock_status.py

Checks whether "Show Seconds in Taskbar Clock" is currently applied.

Usage:
    python check_show_seconds_in_taskbar_clock_status.py
"""

import winreg


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


if __name__ == "__main__":
    main()