start screensaver.scr /s
As long as the .scr
is on the PATH the above command should work.
Make sure you're testing it with a .scr
that is actually installed in Windows.
Note that I got the idea of just invoking the .scr
with /s
from Screensaver Sample Command Line Options:
When Windows runs your screensaver, it launches it with one of three command line options:
- /s – Start the screensaver in full-screen mode.
- /c – Show the configuration settings dialog box.
- /p #### – Display a preview of the screensaver using the specified window handle.
I did some additional searching and found that you could create lock.cmd
:
@start /wait logon.scr /s & rundll32 user32.dll,LockWorkStation
Or lock.vbs
:
Set objShell = CreateObject("Wscript.Shell") ' The "True" argument will make the script wait for the screensaver to exit returnVal = objShell.Run("logon.scr", 1, True) ' Then call the lock functionality objShell.Run "rundll32.exe user32.dll,LockWorkStation"
Neither of these answers is perfect, both reveal a flicker of the desktop after the screen saver is disabled and just prior to the workstation being locked.
It may not be possible to reproduce the system behavior of starting the screen saver and password protecting on resume.