Windows 10 - Screen saver with password from batch file

2

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?

Ben

Posted 2018-01-17T09:11:16.753

Reputation: 255

Answers

1

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

@ECHO OFF
RUNDLL32.exe user32.dll, LockWorkStation
EXIT

Further Resources

Pimp Juice IT

Posted 2018-01-17T09:11:16.753

Reputation: 29 425