🐍 Python 3.10+
Check "Enable Num Lock on Startup" Status (Python)
Reads the registry value behind the "Enable Num Lock on Startup" tweak via winreg to confirm whether it's applied.
check_enable_numlock_on_startup_status.py
#!/usr/bin/env python3
"""
check_enable_numlock_on_startup_status.py
Checks whether "Enable Num Lock on Startup" is currently applied.
Usage:
python check_enable_numlock_on_startup_status.py
"""
import winreg
def main() -> None:
try:
key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r".DEFAULT\Control Panel\Keyboard")
value, _ = winreg.QueryValueEx(key, "InitialKeyboardIndicators")
winreg.CloseKey(key)
print(f"Current value of 'InitialKeyboardIndicators': {value}")
except FileNotFoundError:
print("'InitialKeyboardIndicators' is not set (using the Windows default).")
if __name__ == "__main__":
main()