Change windows wallpaper from command line

To change windows desktop wallpaper what we normally do is right click on the desktop and go properties and so… But we can do the same by editing registry key using reg command from command line. The command is given below.

reg add “HKEY_CURRENT_USER\Control Panel\Desktop” /v Wallpaper /t REG_SZ /d  wallpaper_path /f

For example to set the image E:\photos\image1.jpg as the wall paper we need to run the command as below.

reg add “HKEY_CURRENT_USER\Control Panel\Desktop” /v Wallpaper /t REG_SZ  /f /d D:\photos\image1.bmp

After editing the registry key we need to run the below command to make the change take effect immediately.

%SystemRoot%\System32\RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters

Note that this method works only for bmp images. If you have .jog or .jpeg images you can’t set them as wallpaper from command line. You can use the Desktop settings UI to set a .jpg or .jpeg file as wallpaper.


Background color define:
REG ADD “HKEY_CURRENT_USER\Control Panel\Colors” /v Background /t REG_SZ /f /d “[R G B]”

Desktop wallpaper define:
REG ADD “HKEY_CURRENT_USER\Control Panel\Desktop” /V Wallpaper /T REG_SZ /F /D “[FilePath\Wallpaper.bmp]”

Wallpaper style define:
REG ADD “HKEY_CURRENT_USER\Control Panel\Desktop” /V WallpaperStyle /T REG_SZ /F /D 0

Wallpaper tile define:
REG ADD “HKEY_CURRENT_USER\Control Panel\Desktop” /V TileWallpaper /T REG_SZ /F /D 2

Activate change effect:
%SystemRoot%\System32\RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters

You can put these commands for run at startup via a batch file into following key:

scroll to top