• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4321
  • Last Modified:

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
0
jm021196
Asked:
jm021196
1 Solution
 
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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now