REM Wallpaper-info.bat REM REM Purpose: Display the registry values pertaining to the wallpaper, aka, REM background being used by Windows. REM REM Written By: Jim Cameron (scripts @ moonpoint.com) REM Date Written: 2009-02-14 REM Last Modified: 2009-02-15 REM REM Download URL: http://support.moonpoint.com/support/downloads/computer_languages/mswin_batch/wallpaper-info.bat REM REM Usage: Enter wallpaper-info at a command line REM REM References: REM REM http://support.moonpoint.com/blog/blosxom/2009/02/15#var-substr-forslashf @echo off cls REM Display ConvertedWallpaper value in HKCU\Control Panel\Desktop REM REM Example output of the "reg query" command. Note: Registry keys that REM contain spaces must be enclosed in quotes. REM REM reg query "HKCU\Control Panel\Desktop" /v ConvertedWallpaper REM REM ! REG.EXE VERSION 3.0 REM HKEY_CURRENT_USER\Control Panel\Desktop REM ConvertedWallpaper REG_EXPAND_SZ C:\WINDOWS\Web\Wallpaper\Ripple.jpg REM REM Note: the tab character has been inserted after "delims=", though you REM can't see it unless you are using an octal or hexadecimal editor. REM In Windows Notepad, you can just hit the tab key after the REM "delims=" to insert the tab character, then hit the spacebar. FOR /F "delims= tokens=3" %%R in ('reg query "HKCU\Control Panel\Desktop" /v ConvertedWallpaper') DO SET wallpaper_file=%%R REM At the end of the FOR loop the last line of output is something akin to REM that shown below: REM REM ConvertedWallpaper REG_EXPAND_SZ C:\WINDOWS\Web\Wallpaper\Ripple.jpg REM REM But only the third "token" on the line, i.e. the location REM of the image file is selected. echo Registry key: HKCU\Control Panel\Desktop REM display a blank line echo. echo Value name: ConvertedWallpaper echo Value data: %wallpaper_file% echo. REM Display OriginalWallpaper value in HKCU\Control Panel\Desktop REM Note: the tab character has been inserted after "delims=", though you REM can't see it unless you are using an octal or hexadecimal editor. REM In Windows Notepad, you can just hit the tab key after the REM "delims=" to insert the tab character, then hit the spacebar. FOR /F "delims= tokens=3" %%R in ('reg query "HKCU\Control Panel\Desktop" /v OriginalWallpaper') DO SET wallpaper_file=%%R echo Value name: OriginalWallpaper echo Value data: %wallpaper_file% echo. REM Display Wallpaper value in HKCU\Control Panel\Desktop REM Note: the tab character has been inserted after "delims=", though you REM can't see it unless you are using an octal or hexadecimal editor. REM In Windows Notepad, you can just hit the tab key after the REM "delims=" to insert the tab character, then hit the spacebar. FOR /F "delims= tokens=3" %%R in ('reg query "HKCU\Control Panel\Desktop" /v Wallpaper') DO SET wallpaper_file=%%R echo Value name: Wallpaper echo Value data: %wallpaper_file% echo. REM Display Wallpaper value in REM HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\LastTheme REM REM Example output of the "reg query" command: REM REM C:\>reg query HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\LastTheme /v Wallpaper REM REM ! REG.EXE VERSION 3.0 REM REM HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\LastTheme REM Wallpaper REG_EXPAND_SZ %SystemRoot%\Web\Wallpaper\Ripple.jpg REM Note: the tab character has been inserted after "delims=", though you REM can't see it unless you are using an octal or hexadecimal editor. REM In Windows Notepad, you can just hit the tab key after the REM "delims=" to insert the tab character, then hit the spacebar. FOR /F "delims= tokens=3" %%R in ('reg query HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\LastTheme /v Wallpaper') DO SET wallpaper_file=%%R REM At the end of the FOR loop the last line of output is something akin to REM that shown below: REM REM "Wallpaper REG_EXPAND_SZ %SystemRoot%\Web\Wallpaper\Ripple.jpg REM REM But only the third "token" on the line, i.e. the location of the image file REM is selected. echo Registry key: HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\LastTheme REM display a blank line echo. echo Value name: Wallpaper echo Value data: %wallpaper_file%