Batch – Turn Off Computer Screen

email me

This command turns off the computer screen. Tested on a desktop and laptop.

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,0×0112,0xF170,2)”


Notes

https://social.msdn.microsoft.com/Forums/vstudio/en-US/1bfde62b-fb86-4c63-88b5-a80c87a1ba9f/how-to-correctly-turn-off-monitor-power?forum=csharpgeneral

https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ms704147(v=vs.85)

nircmd.exe cmdwait 1000 monitor off

tags: MrNetTek