69
32
Is there a way to turn off the display in Windows (7), preferably without using additional software?
Powershell script works fine, but leaves command-line window after turning on the display.
69
32
Is there a way to turn off the display in Windows (7), preferably without using additional software?
Powershell script works fine, but leaves command-line window after turning on the display.
41
On a laptop you can use the keyboard shortcut combination of Fn+F7 (F7 might differ depending on the laptop model) and for a desktop you can always use the power button.
Do you need any other specifications such as wake up on mouse movement or something else?
You can always create a shortcut and assign a keyboard shortcut to a black screensaver, use this path:
%systemroot%\system32\scrnsave.scr /s
This will not turn off you screen but make it completely black
+1 for launching scrnsave.scr. This doesn't kick in the actual power save, so I can attach it to a hotkey and turn the laptop monitor off while lid remains open. – LMSingh – 2014-08-04T01:49:08.417
1What's /s
for, it works without the switch as well. – None – 2016-10-02T23:29:40.697
@Chinggis6 no, it does not (or it might, but it should not really). As microsoft's docs say /s
stands for "Run the Screen Saver now", while launching w/o any switch means "Show the Settings dialog box"
2In Windows 10, screen gets black when scrnsave.scr
is entered in the search box or in run dialog, but it requires /s
when executed from cmd.exe
(without it, a dialog pops up informing that this screensaver has no configurable options). – Palec – 2017-06-08T01:22:23.097
1I have desktop and as far as I know it is not possible to set power button to turn off display. Wake up on mouse movement or keyboard key is fine. Black screensaver leaves glow, which is visible at night. – unicoio – 2011-08-10T12:21:31.670
3@unicoio If it's to turn off the screen for the whole night why don't you use the power button on the screen itself? – Greg – 2011-08-10T13:04:30.640
1I arrived at this question over three whole steps, literal strides. Your screensaver answer was exactly what I needed. My LCD TV treats solid complete black as off. – Motes – 2014-03-26T02:57:28.083
34
A couple more options:
nircmd monitor off
from the command line. More information at the link.10+1 for nircmd
. Imho tools set from Nir Sofer and Russinovich should be installed on any advanced user's PC. – Smit Johnth – 2015-04-20T20:11:26.820
I have tools from Russinovich but this is the first time I've heart of Nir Sofer. Looks cool – Luigi Mackenzie C. Brito – 2016-11-05T13:14:29.527
26
You can use WinAPI call SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, 2)
where HWND_BROADCAST = 0xFFFF
,
WM_SYSCOMMAND = 0x0112
and SC_MONITORPOWER = 0xF170
. The 2
means the display is being shut off.
There are several ways to make the call:
Separate executable. You can fire it through a script, command line, Run window, shortcut (*.lnk
), etc. Note that shortcuts can be invoked using a keyboard shortcut. The executable may be written in C or C++, or via P/Invoke in .NET languages (C# or PowerShell), or in many other languages that have a foreign language interface (e.g. JNI in Java).
AutoHotkey script. For a non-programmer, this way is probably simpler. Making customizations still requires some scripting. This script turns monitor off on Win + M:
#m::
Sleep 1000
SendMessage, 0x112, 0xF170, 2,, Program Manager
return
Note the timeout before the SendMessage
call in the AutoHotkey script. It gives the user a chance to release keys (in case their release would wake up the monitor again). Do not forget about it even when making the call from a script in another language.
For more info, see the documentation of SendMessage
function, WM_SYSCOMMAND
message and AutoHotkey SendMessage
. It might be of interest that since Windows 8, using the same method to turn monitor on does not work, but there is a work-around.
2You have an existing ps1 script? They don't usually leave the window open after running. Perhaps there's something in the script that needs to be changed to let the window close? – Ƭᴇcʜιᴇ007 – 2011-08-10T13:16:10.760
4also if you may paste the ps script here - it will be useful for us visitors – Ujjwal Singh – 2012-10-10T19:27:07.910
1How about using the blank screen saver plus setting your power settings to turn off the monitor after some period of non-use? – uSlackr – 2011-08-10T13:47:59.617