Windows can automatically turn off your monitor when it is not in use. On laptops, turning off the display can have a positive effect on power consumption and battery life. When running some long tasks or scripts, you may want to turn off the display to save power. Let’s explore how to turn off the monitor in Windows using the command line, a shortcut, or a keyboard hotkey.
To find out the time after which the screen automatically turns off, open the Power Plan settings in the Control Panel GUI ( control.exe powercfg.cpl,,3
) or use the command:
powercfg /q
Subgroup GUID: 7516b95f-f776-4464-8c53-06167f40cc99 (Display) GUID Alias: SUB_VIDEO Power Setting GUID: 3c0bc021-c8a8-4e07-a973-6b14cbcb2b7e (Turn off display after) GUID Alias: VIDEOIDLE Minimum Possible Setting: 0x00000000 Maximum Possible Setting: 0xffffffff Possible Settings increment: 0x00000001 Possible Settings units: Seconds Current AC Power Setting Index: 0x000004b0 Current DC Power Setting Index: 0x0000012c
In this example, the screen will automatically turn off after 20 minutes when the AC is powered ( 0x000004b0
in HEX).
powercfg -change -monitor-timeout-ac 5
or set the timeout for turning off the display while the device is running on battery:
powercfg -change -monitor-timeout-dc 5
You can turn off the display in Windows by using PowerShell. Execute this command to turn off the display immediately:
Press Win + R
->and run:
cmd.exe /c powershell (Add-Type '[DllImport(\"user32.dll\")]^public static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam);' -Name a -Pas)::SendMessage(-1,0x0112,0xF170,2)
You can create a desktop shortcut to quickly turn off the monitor:
- Right-click on the desktop and select New -> Shortcut;
- Specify this command in the shortcut properties:
cmd.exe /c powershell (Add-Type '[DllImport(\"user32.dll\")]^public static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam);' -Name a -Pas)::SendMessage(-1,0x0112,0xF170,2)
- Set the shortcut name;
- You can assign a hotkey to a shortcut to perform it quickly (shortcut properties -> Shortcut Key -> specify the keyboard shortcut -> in my example it is
Ctrl + Shift + D
)
Now, to turn off the display, click the shortcut on the desktop or press a keyboard hotkey.
If you have more than one monitor connected to your computer, you may want to turn off only one (specific) monitor. This can be done using the ControlMyMonitor utility from NirSoft. (https://www.nirsoft.net/utils/control_my_monitor.html).
Run the tool to list the available monitors, and then use Ctrl+M
to copy the device path of the monitor you need.
To power off a specific monitor from the command prompt, run:
ControlMyMonitor.exe /TurnOff "\\.\DISPLAY2\Monitor0"
Use the second monitor’s hardware power button or the following command to turn on the second monitor:
ControlMyMonitor.exe /TurnOn "\\.\DISPLAY2\Monitor0"