Windows: Turn off all your monitors via the command line
- Create a batch file named
turnoff.bat
on your desktop. - Open it and add the following line
powershell (Add-Type '[DllImport("user32.dll")]^public static extern int PostMessage(int hWnd, int hMsg, int wParam, int lParam);' -Name a -Pas)::PostMessage(-1,0x0112,0xF170,2)
- Save the batch file.
- Run the file to turn off your screens.There will be a brief command-line window that pops up during execution.
Tested on Windows 10.