You are here

powershell

Windows: Turn off all your monitors via the command line

Submitted by Druss on Wed, 2021-11-24 19:26
  1. Create a batch file named turnoff.bat on your desktop.
  2. 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)
  3. Save the batch file.
  4. 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.

Subscribe to RSS - powershell