Bat file set Desktop background

Ask a question

  • Remove From My Forums

How to code batch file to change wallpaper?

Answers

  • Bat file set Desktop background
    Bat file set Desktop background
    0
    Sign in to vote

    You can use the following methods. Both work but neither is "nice":

    • To set the wallpaper on a WinXP machine during boot time: Create a scheduled task that copies your chosen wallpaper .jpg file over the current wallpaper file in the folder c:\Windows\Web\Walpaper. This approach implies that all users use the same file for their wallpaper.
    • To refresh the wallpaper without logging off - use the "Refresh Wallpaper utility from http://www.sg20.com/wallpaperchanger/
    • Marked as answer by Bill_Stewart Monday, July 29, 2013 4:28 PM
    Sunday, March 31, 2013 8:15 AM

All replies

  • Bat file set Desktop background
    Bat file set Desktop background
    0
    Sign in to vote

    How about this:

    @echo off
    copy /y c:\images\wallPaper1.jpg c:\Windows\Web\Wallpaper\CurrentWallpaper.jpg

    Saturday, March 30, 2013 7:22 AM
  • Bat file set Desktop background
    Bat file set Desktop background
    0
    Sign in to vote

    Under the directory, there is no CurrentWallpaper.jpg by default, also there is an option to set the image, such asexpand, center, aligh ...

    If image is gif format, will it work by copy into CurrentWallpaper.gif?

    Do you have any suggestions?

    Thanks you very much for any suggestions


    Thanks in advance for any suggestions

    Saturday, March 30, 2013 8:01 AM
  • Bat file set Desktop background
    Bat file set Desktop background
    0
    Sign in to vote
    You need to replace the file name "CurrentWallpaper.jpg" with the actual name of your wallpaper file. Only you would know what it is.
    Saturday, March 30, 2013 9:27 AM
  • Bat file set Desktop background
    Bat file set Desktop background
    0
    Sign in to vote

    Not a good solution for non-administrators unless you are running Windows 95.

    Usea Reg file to set the registry and just double click reg file.


    ¯\_(ツ)_/¯

    Saturday, March 30, 2013 1:36 PM
  • Bat file set Desktop background
    Bat file set Desktop background
    0
    Sign in to vote

    Just put this line in a batch file.

    REGADD "HKCU\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d %userprofile%\test.jpg /f

    Copying the file over the Windows global file will not ever work if the desktop wallpaper has already been set for the users account. It will also not work if the users profile has been roamed or globalized in other ways.


    ¯\_(ツ)_/¯


    • Edited by jrv Saturday, March 30, 2013 1:49 PM
    Saturday, March 30, 2013 1:47 PM
  • Bat file set Desktop background
    Bat file set Desktop background
    0
    Sign in to vote

    I find some code, it works, but would like to know what wrong on following code shows error on execution.

    Furthermore, wallpaper cannot bereplaced until window XP restarts.

    Is there any approach to update the image without restart window?

    Thanks everyone very much for any suggestions

    @echo off
    reg add "hkcu\control panel\desktop" /v wallpaper /t REG_SZ /d "" /f
    reg add "hkcu\control panel\desktop" /v wallpaper /t REG_SZ /d "D:\ABC.jpg" /f
    reg delete "hkcu\Software\Microsoft\Internet Explorer\Desktop\General" /v WallpaperStyle /f
    reg add "hkcu\control panel\desktop" /v WallpaperStyle /t REG_SZ /d 0 /f
    RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters
    exits


    Thanks in advance for any suggestions


    • Edited by oemMicrosoft Saturday, March 30, 2013 11:17 PM
    • Proposed as answer by abasuoni Tuesday, December 30, 2014 11:05 AM
    Saturday, March 30, 2013 11:16 PM
  • Bat file set Desktop background
    Bat file set Desktop background
    0
    Sign in to vote

    You can use the following methods. Both work but neither is "nice":

    • To set the wallpaper on a WinXP machine during boot time: Create a scheduled task that copies your chosen wallpaper .jpg file over the current wallpaper file in the folder c:\Windows\Web\Walpaper. This approach implies that all users use the same file for their wallpaper.
    • To refresh the wallpaper without logging off - use the "Refresh Wallpaper utility from http://www.sg20.com/wallpaperchanger/
    • Marked as answer by Bill_Stewart Monday, July 29, 2013 4:28 PM
    Sunday, March 31, 2013 8:15 AM
  • Bat file set Desktop background
    Bat file set Desktop background
    0
    Sign in to vote
    Thanks Oemit's perfect (Y)
    Tuesday, December 30, 2014 11:05 AM
  • Bat file set Desktop background
    Bat file set Desktop background
    0
    Sign in to vote

    this solution actually worked for me. if you get an error message for this line :

    RUNDLL32.EXE user32.dll, UpdatePerUserSystemParameters

    Just add a white space between the coma and "UpdatePerUserSystemParameters"

    I know this post is quite dated, but for future references, it might be good to know. (I'm using windows 7)

    Thursday, September 7, 2017 12:46 PM