As the title asks (Windows 7). (How) can I change the time until the screensaver kicks in from the command line? Is it even possible?

Normally I am happy with a 5 minute setting, but occasionally I want to make it longer. I would like the two lengths bound to hot-keys (I know how to do that).

I guess I could record two macros and use those, but I just wondered if there are any command line options (including registry updates) that I can use to tell Windows to start the screen saver after X minutes of inactivity.

(please note, I do not want to start the screen saver immediately; I want to change the length of time Windows will wait before starting it)

Thanks in advance.

[Answer] I finally used a variation on the answer from @Gjordis - but all credit goes to him.

I didn't see why we needed 3 operations : add, delete then rename and reduced that to two.

Since I want to bind to a hotkey, I need to execute two comamnds in one. Normally, one can separate the commands with a semicolon and issue them on one line (e.g dir c:;dir d:). That gave errors with the reg command, so in the end I have two batch files. The contens are identitcal, only the duration changes.

On strange thing - the value is correctly written to the registry, but Control Panel/Personalize/Screen saver does not alwys update its GUI. However, I tested and the screen saver does behave as expected.

@echo off
reg delete "HKEY_CURRENT_USER\Control Panel\Desktop" /v ScreenSaveTimeOut /f
reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v ScreenSaveTimeOut /t REG_SZ /d 180 /f

If this helps you, please upvote the question ;-)

reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v ScreenSaveTimeOut /t REG_SZ /d 600 /f

The value 600 is in seconds, = 10minutes Interestingly, as pointed, this works only the first time. On next change, you need to make a new key like so :

reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v ScreenSaveTimeOutTemp /t REG_SZ /d 300 /f

Then delete the old one

reg delete "HKEY_CURRENT_USER\Control Panel\Desktop" /v ScreenSaveTimeOut /t REG_SZ /d 600 /f

Then copy the new one to the right name

reg copy "HKEY_CURRENT_USER\Control Panel\Desktop" /v ScreenSaveTimeOutTemp "HKEY_CURRENT_USER\Control Panel\Desktop" /v ScreenSaveTimeOut

Hopy this works, and you do not destory your computer, but since you did not have this registry value, i don't think deleting it can be that horrible.

REG documentation here: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/reg.mspx?mfr=true

| improve this answer | |
  • That works :-) The first time only :-( presumably because I didn't have a registry entry the frist time, so could add, but might need to modify subsequently? +1 for trying. Thanks – Mawg says reinstate Monica Mar 5 '13 at 8:04
  • 1
    Edited to hopefully work other times too – Gjordis Mar 5 '13 at 8:14
  • +1 Well, that's trange. I can see that it is updating the registry key, but when I right click the desktop (or go via control panel) and choose "peronalize", it still shows 5 mintes on the GUI. If I set 10 seconds via registry, the screen saver does not start after 10 seconds (or even a few minutes). If I set 1 minute in the GUI then it does start after 1 minute (and it updates the registry correctly). – Mawg says reinstate Monica Mar 5 '13 at 8:44
  • Perhaps it has a valid value -range – Gjordis Mar 5 '13 at 8:46
  • +1 I used a variation on your answer and have posted it in the qustion above. Thanks for your help – Mawg says reinstate Monica Mar 6 '13 at 2:35

In fact, this approach (via registry) doesn't work until reboot. Only way to do that without PC reboot is to use an API:


but APIs can't be used from a command line, i.e. VB script. Here is the reason:


It could be done by calling utility SetScrTimeout.exe (from the first link), but unfortunatelly, this small utility doesn't exist on internet anymore.

| 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.