Set screensaver via a batch script

Ok heres a nice and simple one :)

I need to set a screensaver to be the active one...in a batch script without any interaction (ie no clicking ok or apply or anything).

Any help is apprechiated :)

mitch
LVL 1
jm021196Asked:
Who is Participating?
 
oBdACommented:
Configure the screen saver.
Start regedit, export HKCU\Control Panel\Desktop to a file, for example screensaver.reg.
Open screensaver.reg in notepad, remove the the lines you don't need, so that you'll only have something like this left:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Control Panel\Desktop]
"ScreenSaveActive"="1"
"ScreenSaverIsSecure"="1"
"ScreenSaveTimeOut"="900"
"SCRNSAVE.EXE"="C:\\WINNT\\system32\\logon.scr"

That will enable the screen saver itself. As for the configuration, this is in a subkey of HKCU\Control Panel for the standard screen savers (might be someplace else for third-party screen savers).
Export the one you want to configure as well, for example Mystify:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Control Panel\Screen Saver.Mystify]
"Active1"="1"
"Active2"="1"
"Clear Screen"="1"
"EndColor1"="255 255 255"
"EndColor2"="255 255 255"
"Lines1"="7"
"Lines2"="12"
"StartColor1"="0 0 0"
"StartColor2"="0 0 0"
"WalkRandom1"="1"
"WalkRandom2"="1"

Open it in notepad as well, highlight the lines without the first one; copy them into the clipboard, paste them into the screensaver.reg notepad file, so that it will look like that:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Control Panel\Desktop]
"ScreenSaveActive"="1"
"ScreenSaverIsSecure"="1"
"ScreenSaveTimeOut"="900"
"SCRNSAVE.EXE"="C:\\WINNT\\system32\\logon.scr"

[HKEY_CURRENT_USER\Control Panel\Screen Saver.Mystify]
"Active1"="1"
"Active2"="1"
"Clear Screen"="1"
"EndColor1"="255 255 255"
"EndColor2"="255 255 255"
"Lines1"="7"
"Lines2"="12"
"StartColor1"="0 0 0"
"StartColor2"="0 0 0"
"WalkRandom1"="1"
"WalkRandom2"="1"

Save the screensaver.reg file.
You can now import it using
regedit /s "P:\ath\to\screensaver.reg"
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.