-
-
Save yallie/019c5d9e527251e96d8ffff167f2523b to your computer and use it in GitHub Desktop.
Turns off the screen and locks the workstation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
:: see https://www.makeuseof.com/tag/3-quickest-ways-turn-computer-screen-windows/ | |
:: see https://gist.github.com/EugeneLoy/150044d04b08e35d09e164c864e78da7 | |
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) | |
:: see https://www.pcreview.co.uk/threads/create-a-batch-file-to-lock-computer.3747748/post-12994020 | |
Rundll32.exe User32.dll,LockWorkStation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Place this batch file on your Windows desktop. Tested on Windows 11.
To enable a hotkey, create a shortcut for the batch file, set an option to start minimized and set a decent hotkey, for example, Ctrl+Alt+Shift+L.