Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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]
"ScreenSaveTimeOut"="7200"
"SCRNSAVE.EXE"="C:\\WINDOWS\\system32\\scrnsave.scr"

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?

share|improve this question

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.