User Tools

Site Tools


blog:change_windows_desktop_background_for_day_and_night_using_batchfile

This is an old revision of the document!


Change windows desktop background for day and night, using batchfile

REM :: chwpdn. batchange to CHange the WallPaper for Day and Night
REM :: v1.0 B.Brunner, 23.12.2010 (brb_trash at epr dot ch)
REM Prepare two bmp files to be used during day and night 
REM - jpgs dont work directly, convert to bmp of your screen resolution first!
REM - change start and end day hour to your needs
REM - store this batchfile in a place like e:\etc
REM - make a link to this batchfile in your autostart folder (set minimized in the link)
REM - using the task manager have the batchfile start every hour, to switch during the day
REM 
REM Configuration changes go here
set wpnight=e:\etc\wallpaper_night.bmp
set wpday=e:\etc\wallpaper_day.bmp
set daystarthour=8
set dayendhour=20
 
REM Set hours variable 
for /f "tokens=1-3 delims=:." %%a in ( "%time%") do set hours=%%a
 
REM Use day wallpaper, except from 00:00-08:00 and 20:00-23:59
set wallpaper=%wpday%
if %hours% LSS %daystarthour% goto setnight
if %hours% GTR %dayendhour% goto setnight
goto setit
 
:setnight
set wallpaper=%wpnight%
 
:setit
Echo Setting wallpaper to %wallpaper%
 
REG ADD "HKCU\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d %wallpaper% /f 
RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters

~~LINKBACK~~

Discussion

Enter your comment. Wiki syntax is allowed:
  ____    ___    _  __   ___   _   __
 / __ \  / _ )  / |/ /  / _ | | | / /
/ /_/ / / _  | /    /  / __ | | |/ / 
\____/ /____/ /_/|_/  /_/ |_| |___/
 
blog/change_windows_desktop_background_for_day_and_night_using_batchfile.1293088486.txt.gz · Last modified: 2010-12-23 08:14 by brb