hello
i am trying to make a cmd file to change my background.
this is the cmd i am trying to use:

REG ADD HKCU\Control Panel\Desktop /v Wallpaper /t REG_SZ /d C:\Windows\newbackground.bmp /f

what am i doing wrong?
when i enter this on cmd i get: invalid syntax. type reg add /? for usage.

thankyou in advance

If this is a .BAT file, you will have to run it or the associated command prompt window with Administrative privileges to get this to work.

Also, for your syntax problem, try this:

REG ADD "HKCU\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d C:\Windows\newbackground.bmp /f

I also found on the web, you can add this line in the batch file to refresh the desktop:

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

i now get: the cmd completed sucessfully
and the wallpaper doesnt change. i navigate to the value in regedit and it shows the path of the bmp file(good): "C:\Users\TheGang\Desktop\Adams Folder\Random\batch\hiddenpic.bmp"

and yes i added the refresh value but it still doesnt change :(
thnx 4 ur reply in advance :)

i now get: the cmd completed sucessfully
and the wallpaper doesnt change. i navigate to the value in regedit and it shows the path of the bmp file(good): "C:\Users\TheGang\Desktop\Adams Folder\Random\batch\hiddenpic.bmp"

and yes i added the refresh value but it still doesnt change :(
thnx 4 ur reply in advance :)

just closing off this thread with a conclusion:
the batch script worked perfectly. all i had to do is restart my computer.
here is the final script: @echo off
REG ADD "HKCU\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d "picture_location.bmp" /f
%SystemRoot%\System32\RUNDLL32.EXE user32.dll
restart

thanks to those who replied for their help :)

Yeah, a reboot would take care of it. A log off and back on might as well. The second line in the code was suppose to do it without having to reboot.

Anyway, glad it worked!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.