none
[win10]how to change win10's desk wallpaper and refresh right now? RRS feed

  • Question

  • I have written a simple bat script, but it occasionally take effect, most of the time doesn't. Who can help me to find out how to solve, thanks.

    i want to use bat script refresh wallpaper right now, neither logoff nor reboot.

    ======start======

    @echo off
    ::Set the variable.
    set ImageFile="c:\wallpaper.jpg"
    set WallpaperFile="c:\windows\WEB\Wallpaper\Windows\img0.jpg"
    set CachedFileFolder="%APPDATA%\Microsoft\Windows\Themes\CachedFiles\"
    set TranscodedFile="%APPDATA%\Microsoft\Windows\Themes\TranscodedWallpaper"

    ::Get file permissions.
    takeown /f %WallpaperFile%
    ::takeown /f C:\Windows\Web\4K\Wallpaper\Windows\*.*
    icacls %WallpaperFile% /Grant %USERNAME%:(F)
    ::icacls C:\Windows\Web\4K\Wallpaper\Windows\*.* /Grant %USERNAME%:(F)

    ::Delete old file and copy the new one.
    del %WallpaperFile%
    copy %ImageFile% %WallpaperFile%
    copy %ImageFile% %TranscodedFile%

    ::Specifies where pictures are cached.(i have specified the path: c:\windows\WEB\Wallpaper\Windows\img0.jpg)
    REG ADD "HKCU\Control Panel\Desktop" /V TranscodedImageCache /T REG_BINARY /D 7ac301005e8e0300e0070000400500007221a48ea366d20143003a005c00570069006e0064006f00770073005c005700650062005c00570061006c006c00700061007000650072005c00570069006e0064006f00770073005c0069006d00670030002e006a007000670000 /F

    ::Sets the background image path and presentation mode.
    REG ADD "HKCU\Control Panel\Desktop" /V Wallpaper /T REG_SZ /D %WallpaperFile% /F
    REG ADD "HKCU\Control Panel\Desktop" /V WallpaperStyle /T REG_SZ /D 2 /F
    REG ADD "HKCU\Control Panel\Desktop" /V TileWallpaper /T REG_SZ /D 0 /F

    ::Refresh the background.
    %SystemRoot%\System32\RUNDLL32.EXE USER32.DLL,UpdatePerUserSystemParameters 1, True

    =====the end======

    thanks.


    • Edited by mr.kyle Sunday, January 8, 2017 9:09 AM edit
    Sunday, January 8, 2017 9:05 AM