I know I can change the settings for the screensaver in Windows XP from the command line by updating the registry as follows:

regedit.exe /s settings.reg

Where settings.reg contains:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Control Panel\Desktop]

However, the settings do not take effect until I log out and back in. If I change the settings via Display Properties they take effect immediately.

Yes, it is Windows XP. Yes, there's a reason for it.

I know about SetScrTimeout.exe so I know it can be done. I can't use that tool on my system though and would prefer something homegrown.

How can I make these changes take effect immediately when changing the registry from the command line?


While Windows stores the screensaver configuration in the registry, it doesn't check it for changes constantly. That would be rather inefficient.

The correct way to change the configuration is using the SystemParametersInfo function of Win32. For convenience, the desktop control panel DLL exports a function that is easily accessed from the command line that will call that function for you. Just run the following command:

rundll32.exe desk.cpl,InstallScreenSaver file.scr

That being said, the following command should force Windows to reread the configuration from the registry:

rundll32.exe user32.dll, UpdatePerUserSystemParameters

As an aside, you might find it easier to modify the registry from the command line by using the REG command, rather than writing .reg files all the time.

  • “That would be rather inefficient” — unless MSW defined an API to subscribe to changes in the registry! I also note that SystemParameterInfo does not include a selector to specify the screen saver to be used. Could you perhaps add a link to documentation of the use of the DLL with rundll32?
    – PJTraill
    Nov 8 '16 at 15:35

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.