4

I've been using nircmd to turn off the monitor/display of various PCs like so:

nircmd.exe cmdwait 1000 monitor off

The cmdwait 1000 part just adds a 1 second delay (to let the last keystroke and mouse movement end) before turning off the display. This has worked for 10+ years.

I just now came across a Win10 PC that actually goes to sleep from this command instead of just turning off the monitor. What could be causing this, and how can it be fixed?

The PC in question in an ASUS Zenbook. Let me know if any more information is needed.

Update: I also tried this WinAPI call via powershell to turn off the display, and it also results in the PC going to sleep:

(Add-Type -MemberDefinition "[DllImport(""user32.dll"")]`npublic static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam);" -Name "Win32SendMessage" -Namespace Win32Functions -PassThru)::SendMessage(0xffff, 0x0112, 0xF170, 2)
Bort
  • 1,714

3 Answers3

1

I critically need a hack to accomplish the same.

Things have changed since Windows 10. Now, Microsoft disallows a simple light-off for the screen! Actually, Power Management in Windows hasn't worked right in any version of Windows I've used, and now they've deliberately added to the blight.

Microsoft's tech-support isn't of any help with this. See my long chat with them from yesterday here: https://docs.google.com/document/d/15LmihHAiiWgJQsE2Y_kafURWFfGQ82ekmtXH-WD0xHM/edit?usp=sharing

For those who can program, acting on system power management messages like WM_POWERBROADCAST might be a work-around/solution. However, I've failed so far to detect that message when issuing a command to turn off the monitor via "nircmd.exe monitor async_off" or a SendMessage command.

See also: https://docs.microsoft.com/en-us/windows/win32/power/system-power-states

Sleep (Modern Standby) S0 low-power idle

https://docs.microsoft.com/en-us/windows-hardware/design/device-experiences/modern-standby "Windows 10 Modern Standby (Modern Standby) expands the Windows 8.1 Connected Standby power model. Connected Standby, and consequently Modern Standby, enable an instant on / instant off user experience, similar to smartphone power models."

["instant on" here is a lie. I get a 2 second delay on a very costly laptop. Plus, when the laptop monitor is shut off, Win11 turns off most other activity too, like scripts that are running, downloads, etc.! Since when does the definition of "monitor off" mean put the entire computer into sleep/standby? Is Microsoft mocking us?]

rs20
  • 11
1

Here's one I tried on windows and it worked. Puts monitor to sleep only. Turns on mouse hover. Very useful .

Using NirCmd.

Once installed

  • create a new shortcut on your desktop

  • In the location field, type:

    C:\Path\To\nircmd.exe monitor off

(Replace C:\Path\To\ with the actual path where you saved nircmd.exe.)

Name the shortcut (e.g., "Turn Off Screen") and you're done.

Download link ️ https://www.nirsoft.net/utils/nircmd.html#google_vignette

Akash
  • 21
0

turn monitor off

Im on Windows10x64, doing it as shortcut as described on this video working

right click > New Shortcut paste :

powershell.exe -Command "(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)"

prevent computer to go to sleep

you have to go Control Panel > Power Options > Change when the computer sleeps > choose never for 'Put the computer to sleep'

if for any reason, these is not working search google for mouse jiggler

Zakari
  • 101
  • 1