My laptop at work connects to two other screens. Every time I lock the laptop (using WinKey + L) and unlock, all of the open applications move back on to the laptop screen regardless of whether they were on one of the external monitors at the time of locking the laptop.

When the machine locks via the screen saver being activated however, the open applications remain on their respective screens when unlocking.

I would like to be able to activate the screen saver via a batch file so I can run that instead of locking the machine normally when I walk away from my desk.

If I just run the ".scr" file from "C:\windows\System32" it displays the screen saver, but doesn't request the password be entered when moving the mouse.

Does anyone know how to activate the screen saver (via a batch file/powershell script/key press) that will require a password after the mouse has been moved?


Lock Windows Screen from Command Line or a Batch Script

You can run RunDLL32.exe passing it arguments accordingly to lock the screen from Windows 10 in a batch file like the example below.

Batch Script

RUNDLL32.exe user32.dll, LockWorkStation

Further Resources

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.