I am trying to get a script to work that will change the default wallpaper for windows 10 because I will be deploying Win10 to all clients. When I run the batch code below, it is not changing the default wall paper. I see that the img0 file is in the correct directory C:\Windows\Web\Wallpaper\Windows but it is not changing the background. The code below is what I am using. I do get some access denied errors when trying to del C:\Windows\Web\4K\Wallpaper\Windows\img0_1366x768.jpg Access is denied.
takeown /f c:\windows\WEB\wallpaper\Windows\img0.jpg
takeown /f C:\Windows\Web\4K\Wallpaper\Windows\*.*
icacls c:\windows\WEB\wallpaper\Windows\img0.jpg /Grant System:(F)
icacls C:\Windows\Web\4K\Wallpaper\Windows\*.* /Grant System:(F)
del c:\windows\WEB\wallpaper\Windows\img0.jpg
del /q C:\Windows\Web\4K\Wallpaper\Windows\*.*
copy %~dp0img0.jpg c:\windows\WEB\wallpaper\Windows\img0.jpg
copy %~dp04k\*.* C:\Windows\Web\4K\Wallpaper\Windows
Any ideas what I am doing wrong? TIA
To change windows desktop wallpaper what we normally do is right click on the desktop and go properties and so on. But we can do the same by editing registry key using reg command from command line.
Change windows wallpaper from command line bySrini To change windows desktop wallpaper what we normally do is right click on the desktop and go properties and so on. But we can do the same by editing registry key using reg command from command line.
We can set a bmp image as wallpaper. ≡ Menu Windows Commands, Batch files, Command prompt and PowerShell Change windows wallpaper from command line bySrini To change windows desktop wallpaper what we normally do is right click on the desktop and go properties and so on.
bySrini To change windows desktop wallpaper what we normally do is right click on the desktop and go properties and so on. 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
Use Powershell to change the wallpaper. First, create a function like this:
Function Set-WallPaper($Value)
{
Set-ItemProperty -path 'HKCU:\Control Panel\Desktop\' -name wallpaper -value $value
rundll32.exe user32.dll, UpdatePerUserSystemParameters
}
Now call the function:
Set-WallPaper -value "path to wallpaper"
I know this has already been answered, but if someone wants to do this in a batch file the icacls lines need to use /reset instead of the /grant... something like:
takeown /f c:\windows\WEB\wallpaper\Windows\img0.jpg
icacls c:\windows\WEB\wallpaper\Windows\img0.jpg /reset
copy %~dp0img0.jpg c:\windows\WEB\wallpaper\Windows\img0.jpg
copy %~dp04k\*.* C:\Windows\Web\4K\Wallpaper\Windows
should work (as long as it is being run by an Administrative account).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With