8

I am looking for a way to turn my screensaver on immediately, or turn off the screen, either when I lock the screen (WIN-L) or by clicking on something on the desktop.

I have located MonitorES as a possible solution, but it appears to be somewhat out of date and I am concerned it does not support Windows 10 particularly well as it hasn't been updated in some time. It also does not support my media player of choice (SMPlayer).

Any ideas/suggestions on how to do this via a Windows setting/shortcut or some other way?

1
  • 2
    Win+L to lock the screen? – ejbytes Jun 8 '16 at 7:12
3

The built-in screensavers should be in the %windir%\SysWOW64 folder (e.g. Mystify.scr, Ribbons.scr, scrnsave.scr). You could add a Windows shortcut that runs one of these files. You could also add a shortcut key.

4
  • Agreed, screen savers are just renamed .exe to .scr files that you can actually run. – Overmind Jun 8 '16 at 5:15
  • 3
    That won't lock the PC though. Or will it? – Charles Goodwin Jun 8 '16 at 6:08
  • Simple enough to check out following the link. I tried it, but as soon as you press Win, or any key, the screen saver disappears. – ejbytes Jun 8 '16 at 7:05
  • @CharlesGoodwin Yup, you're right.. that does NOT lock the PC. I have a screensaver on right now, and when I activate it, it does NOT lock the screen, in fact, I see the task bar at the bottom.... – Malachi Dec 12 '16 at 16:49
2

Answer:

I have 2 different tools for this at https://gist.github.com/RichardBronosky/c61465ed897c2f10e9bf16704d1d9af9

To make this a legitimate SO answer, I'll include the simpler one:

#!/bin/bash
# From: https://gist.github.com/RichardBronosky/c61465ed897c2f10e9bf16704d1d9af9
# This works from both WSL/bash and powershell!

powershell.exe -command "& (Get-ItemProperty 'HKCU:Control Panel\Desktop').{SCRNSAVE.EXE}"

This will get the value of the [terribly named] SCRNSAVE.EXE property from the registry. That value just happens to be a complete path to a *.scr file, and therefore you can (and I do) tell powershell to run it as a command.

Notes/Opinion:

This is a pretty succinct demonstration of how powershell returns objects (complete with methods, accessors, etc.) rather than streams of text like bash.

Here, the Get-ItemProperty returns an object [of type: System.Management.Automation.PSCustomObject] that has many properties. We access a single property with the convenient dot notation. (I have to admit that even though I can write sed directly into a script without testing it at the CLI, this IS better.) There is a useful tool for exploring objects that is recommended by a Microsoft technet blogger. Unfortunately, installing it now requires the -AllowClobber option. (Learn more here.) A slightly less convenient [flat] alternative is Get-Member. (Just pipe output to it.)

Having a 1/4 century of bash experience, powershell is very strange, but also a bit refreshing to work with. Just think of it as shell scripting in a more pythonic environment and it's not terrible... except for those backslashes.

1
  • This doesn't look like it will lock the computer as well. – mbomb007 Sep 12 '19 at 16:46
1

This opensource app adds hot corners, and you can set one of them with the Lock option. The website is minimalist but the app works fine on Windows 10 and with multiple monitors.

The last build lacks one feature, which is the ability to put the monitor to Sleep rather than locking. If you need that, you can compile the source yourself.

0

I offer the next solution: Create a .bat file with the next content:

for /f "tokens=3" %%a in ('reg query "hkey_current_user\control panel\desktop" /v scrnsave.exe') do start "" /wait /d "%%~dpa" "%%~nxa" /s
tsdiscon

And launch it when you want to lock the session.

Explanation.

I wanted to do smth described in the title, but didn't find a way to do it (I hope, yet). Therefore I decided to follow the way from the screensaver settings: to lock session as continuation of the screensaver.

The screensaver settings

The script takes a key value for the screensaver from the windows registry and use it to start a pre-configured screensaver. That's why it works only after configuring a screensaver in Windows. You can configure screensaver settings here (press Win+R, enter text below and press OK):

control.exe desk.cpl,screensaver,@screensaver

Also:

  1. You can reach the screensaver settings via GUI.

  2. You can use "rundll32 user32.dll,LockWorkStation" instead of "tsdiscon", but I prefer the second way.

  3. I have an idea to hide all windows before launching a screensaver to prevent reading information during switching to the lock screen.

  4. You can try to find 3rd party app =)

I wanted to find info how to do the same from cmd, but when I didn't find necessary information I decided to join information from the next resources:

Similar question on StackOverflow

Configure screensaver via cmd

and, of course, for /?, reg /? etc. =)

-1

Solution: Windows 7/8/10

Right-click on desktop, select New > Shortcut with Target set to:

C:\Windows\explorer.exe "C:\Windows\System32\Fliqlo.scr

(or some another screensaver, Fliqlo.scr is just example)

...you are welcome..

2
-1

It's an old question but I found a software that you can use and I'm using btw.

https://github.com/ukanth/monitores

Just activate "Auto SSaver On" and after you lock your PC SS turns on

->Software

Explanation & HowTo

https://www.howtogeek.com/146439/how-to-make-windows-start-the-screensaver-immediately-when-locked/

-2

This is definitely a hack and will require programming. It was an interesting idea and so I used keywords and found out for you.

OpenSource idea:
http://www.howtogeek.com/146439/how-to-make-windows-start-the-screensaver-immediately-when-locked/

Download this and install for your desired result.

0
-2
  1. Open text editor
  2. Paste this: control.exe desk.cpl,screensaver,@screensaver
  3. Save as batch file
  4. Copy batch file to desktop or wherever.
  5. Finish
1
  • This merely opens the Screen Saver Control Panel. We want to activate the screen saver as if the system had been idle for the timeout and, e.g., trigger the requirement that the user enter the password to access the computer (WITHOUT sleeping the display). – binki Mar 19 '19 at 19:53

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.