Changing monitor brightness with a hotkey using AutoHotKey


Sometimes you need to quickly decrease or increase screen brightness without extra clicks. On my laptop this used to be handled by the built-in ASUS utility, but it always messed with the fan control, so I had to remove it. In the end, you can just use this script.

  1. Download AutoHotKey
  2. Create a .ahk file and put this inside:
F1::
Run, cmd /c wmic /namespace:\\root\wmi PATH WmiMonitorBrightnessMethods WHERE "Active=1" CALL WmiSetBrightness Brightness=10 Timeout=1
return

F2::
Run, cmd /c wmic /namespace:\\root\wmi PATH WmiMonitorBrightnessMethods WHERE "Active=1" CALL WmiSetBrightness Brightness=100 Timeout=1
return

It didn’t work through PowerShell, so I used the internal Windows way.

What the script does:

  1. Runs Windows Command Prompt (cmd /c) and executes the wmic utility.
  2. wmic accesses the WMI namespace root\wmi, selecting the WmiMonitorBrightnessMethods class (responsible for monitor brightness control methods).
  3. The filter WHERE "Active=1" means it applies only to the active monitor.
  4. CALL WmiSetBrightness Brightness=10 Timeout=1 — calls the WmiSetBrightness method to set brightness to n%. The Timeout=1 parameter specifies the delay in seconds.

Now the F1 key lowers brightness to 10%, and F2 raises it to 100%. You can adapt the script to any values and hotkeys. Enjoy! 😀


This entry was posted in Windows 11 (en). Bookmark the permalink.

Leave a Reply

🇬🇧 Attention! Comments with URLs/email are not allowed.
🇷🇺 Комментарии со ссылками/email удаляются автоматически.