2

I need a shortcut to turn off my monitor (not put my computer to sleep) that doesn't require downloading a third party application.

John
  • 251

1 Answers1

4

Managed to make a solution. Posting here for future reference.

Created a shortcut and set this as the target:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -command "(Add-Type -MemberDefinition '[DllImport(\"user32.dll\")] public static extern int PostMessage(int a, int b, int c, int d);' -Name f -PassThru)::PostMessage(-1, 0x112, 0xF170, 2)"

Thanks to Jari Turkia for the original snippet. https://superuser.com/a/1542141/327522

Edited down to work via command line and within 255 character limit.

John
  • 251