Useful Windows Hacks - Turn off Monitor / Screen from .bat file

0 43
Avatar for effgee
Written by
3 years ago

With the following "code" you can create a shortcut on your desktop (or wherever) and shut off your monitor with a double click.

TurnOffScreen.bat

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)

Copy the above code into a text editor and save it with the .bat file extension. As you can see it is a PowerShell command, and can also be used as a PowerShell script.

I use this code to quickly shut off my screen when I want to go to sleep.

1
$ 0.32
$ 0.32 from @TheRandomRewarder

Comments