Single Keyboard Shortcut to Minimize Application Windows then Lock & Turn off Screen

I make Windows desktop shortcut that minimize all windows then lock and turn off screen by single press of Ctrl-Alt-L keys.
This is improvement over regular Windows-L shortcut that only locks screen.
Turning off the screen definitely saves power consumption.
Minimizing application windows also can save CPU and memory utilization in some programs.

It does not need third party software and works without administrative priviledge.
You only need to create text-based DOS-style batch file, make shortcut in Desktop into it then assign keyboard sequence for it.

1. Create DOS-style Batch File

Using text editor, such as Notepad, create text file, e.g. lockscreen.bat, containing texts below.
I suggest to store it in locally mapped cloud drive, e.g. Onedrive, so you can use same file for multiple Windows PCs.

REM #####################################################
REM Lock screen:
c:\windows\system32\RunDll32.exe user32.dll,LockWorkStation

REM Minimize all aplication windows:
PowerShell -Command "(New-Object -ComObject Shell.Application).MinimizeAll()"

REM Wait for 5 seconds then Turn Off Screen (this is to give you time to see that the screen is locked):
PING localhost -l 0 -n 5 >NUL
powershell (Add-Type '[DllImport(\"user32.dll\")] public static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam);' -Name a -PassThru)::SendMessage(-1,0x0112,0xF170,2)
REM #################################################

2. Create Desktop Shortcut

Right click the BAT file then click Send To >>> Desktop to create desktop shortcut.

3. Assign Keyboard Shortcut

Right click the Desktop shortcut then edit the Properties.
Type key sequence that you like in Shortcut Key, e.g. Ctrl-Alt-L.

Click OK and DONE.
Now you can click the simple shortcut key sequence to minimize windows and lock & turn off screen at once.

Comments