Join 92,239 users already on

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

0 12 exc
Avatar for effgee
Written by   3
1 year ago

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


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.

$ 0.32
$ 0.32 from @TheRandomRewarder
Enjoyed this article?  Earn Bitcoin Cash by sharing it! Explain
...and you will also help the author collect more tips.