Change background of a Windows 7 machine using Registry

18

6

I connected my machine to a work group. The settings to change the wallpaper is in server machine, so that all the machine will have same wallpaper. Now how can I change my machine's wallpaper using registry ?

After reading some answers,

I created Wall.reg with the following content, and created a shortcut in Start up folder, so that the file will be executed automatically.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Control Panel\Desktop]
"Wallpaper"="C:\Users\Public\Pictures\Sample Pictures\Koala.jpg"

Am I missing anything ? It is not working :(

Rauf

Posted 2012-01-16T11:36:04.830

Reputation: 2 685

1Try using double slashes in wallpaper path. – thane – 2012-01-16T14:02:47.447

Answers

9

Navigate to

HKEY_CURRENT_USER\Control Panel\Desktop

and change Wallpaper key value to the full path of your image.

thane

Posted 2012-01-16T11:36:04.830

Reputation: 1 627

1@JoeTaylor - Not if, instead of changing the path, you find the Path and replace the image with the image you want, but with the same name. :) – Suamere – 2015-07-17T20:42:00.550

1@Suamere - Which if it's server hosted (which it should be) would be impossible for a normal user. – Joe Taylor – 2015-07-19T08:35:53.130

9And every time you logon the GPO will reset your wallpaper to the original. – Joe Taylor – 2012-01-16T11:52:54.700

3

I know this is an old tread, and Windows 7 is an OS fast becoming obsolete. But for the occasional user: I have dealt with this for years in my shop. I am close enough to IT to have certain privileges on my laptop, but not close enough to stop then making stupid GPOs which - of course - affects me as well.

On XP I am certain, on Windows 7 this is just an inspiration: This kind of changes to Registry will not take effect until you reboot the system! And since you try to circumvent a GPO, this equals "mission impossible" in many situations. There are, however, a way to force an update of the Registry to be applied without rebooting...

The thing is: You don't need to reboot - you need to flush the cashe of registry settings - which is a part of a reboot.

Solution (on XP at least):

@echo off
call :quiet>nul 2>&1
goto :EOF
:quiet
:: Configure Wallpaper (command prompt method works only with bmp files)
REG ADD "HKEY_CURRENT_USER\Control Panel\Desktop" /V Wallpaper /T REG_SZ /F /D "C:\WINDOWS\Web\Wallpaper1.bmp" 
REG ADD "HKCU\Control Panel\Desktop" /V WallpaperStyle /T REG_SZ /F /D 0
REG ADD "HKCU\Control Panel\Desktop" /V TileWallpaper /T REG_SZ /F /D 1
:: Make the changes effective immediately (only XP-compatible)
RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters

This works (worked) well for me on my XP machine, the trick being the last line: Execute "user32.dll,UpdatePerUserSystemParameters" as part of the bat-file. This takes the place of a "reboot". :-)

I put this in the Start folder, and added a shortcut key combination to the bat file: This way, my pc started with my own wallpaper, and when the GPO refreshes a couple of times during the day, I hit the shortcut key, and get my preferred view back (Which is infinitely prettier than the "black screen of depression" which is company stock) ;-)

I haven't got around to fix this on my new laptop (running Win 7) yet, but I guess someone out there can get inspired by this (XP) behavior and research further.

Hansjp

Posted 2012-01-16T11:36:04.830

Reputation: 61

1@Ramhound - Well, down-voting it is a little rash, if you ask me! Of course, I haven't - otherwise I would have said so - and not writing "I haven't got around to fix this on my new laptop (running Win 7) yet, but I guess someone out there can get inspired by this (XP) behavior and research further." I came across this page looking for a way to do this on my Win 7 box... and had you had a little patience, you would have seen my update to come next... – Hansjp – 2015-08-22T12:28:17.487

I just deleted my comments to avoid unnecessary pings – Ramhound – 2017-08-03T02:21:11.637

2

For those of you out there still dealing with XP boxes, I leave my previous answer intact.

However, I can now share an approach to solve the problem on a Windows 7 box:

  1. As I said before, you don't want to reboot the pc, because you are
    battling a Group Policy which is enforced on reboot (and in my
    personal case, every few hours during the day). However, changes to
    the registry need a flush of cashed settings before they become
    active. A reboot does that.

We need to find another way of accomplishing the target: "change-background-of-a-windows-7-machine..." - I skip the "using-registry" part, because I don't think it is possible, and frankly, I don't think it is the right approach on Windows 7! It was on XP - as I have stated in my previous answer.

The magic word now is "Themepack" - and the magic knowledge is: "It is executable!" What you need is an automated method of executing it and dealing with its embedded consequences.

  1. I use AutoHotkey version 1.1 (http://ahkscript.org/) for a number of things on my laptop, and if you have the permissions necessary for running this program, you are good to go:
  2. (Assuming you do nothing else with AutoHotkey): Create a txt file, name it anything but give it an ".ahk" file name extension instead of ".txt", and save it to the Startup folder ("C:\Users\ insert your username \AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup" in my case). Now it will run at every startup.

Edit the file using Notepad or similar tool: Insert these lines:

    ; Setting wallpaper on the desktop on Win 7 which is: Apply a Themepack!
    <^<+D::
     Run "C:\Laptop theme.themepack"  ; Apply your Themepack
     WinWait Personlige indstillinger ; Wait for the window to get focus (the appearance is mandatory on an "apply" command)
     WinClose                         ; Close the last found window
    return

Note that I not only run the code at Startup, I also attach a hotkey (LCTRL+LSHIFT+D), which executes this part of the script at will.

Note also the command line "WinWait": My system is Danish, so the title of my Personalization window is "Personlige indstillinger". You need to insert here the title of the window on your own system. Read AHK help files how to do so, if it isn't obvious enough for you to guess it right to begin with.

  1. Now, all which remains is to Personalize your Windows 7 Laptop once and for all (unless a Group Policy prevents you (users) from changing things, you can always change things). When you are satisfied, save the resulting Themepack on the path you gave in the script (i.e. "C:\Laptop theme.themepack"), and done.

  2. Note: If you can't save anything on "C:\" then you can put the themepack anywhere - including in your personal user folders. The advantage of this is that you keep the script even when IT department is changing your laptop - provided they care to backup your user folders. My personal taste is just to keep things short, and I don't like connecting to network shares during startup if I can help it. Which I can.

Hansjp

Posted 2012-01-16T11:36:04.830

Reputation: 61

1And of course.. the obvious always hide in plain sight! You can simply save the Themepack in the Startup folder!... That is all the "autoexecute on startup" you want. I believe by rule this will always execute after the GPOs - it is at least on my system. The only drawback: You need to manually close the settings-window, when you don't script that part. But it saves you the hazzle of AutoHotkey, so I guess its worth mentioning. – Hansjp – 2015-08-22T14:17:26.807

So... how does on create a Themepack? – Emanuele Ciriachi – 2018-11-26T09:51:17.080

1You can't help but having one. Windows build one for you when you boot up the operating system. If you make changes to, say, the desktop image, a "non-saved theme" will appear on its own. All you need to do is to 1) save it to get the file, and 2) copy the file to a placering where it stays. To find it: right-click the desktop, choose Personal settings. – Hansjp – 2018-11-27T10:15:52.997

1

If the Server controls your wallpaper via a GPO then you will have to reset your wallpaper every time you login or the GPO is updated on your machine.

You could create a reg file modifying the values correctly and save it on your desktop, making this run at every logon would give you the wallpaper you desire after every logon. Use the registry Key that Thane provides and export the correct value. Anytime you import this it will modify the registry to the value you want.

Things to consider:

Are you breaking company IT policy doing this?
Can you modify the registry? and create startup tasks to do so? i.e do you have the priveleges?
Is it worth the hassle?

Joe Taylor

Posted 2012-01-16T11:36:04.830

Reputation: 11 533

I can edit the registry. Can you give me idea about how can I create reg file and all. ? – Rauf – 2012-01-16T12:06:51.333

Please see my edit. – Rauf – 2012-01-16T12:39:58.770

If you just import the registry key manually. i.e double clicking on it. Does it work? – Joe Taylor – 2012-01-16T13:41:07.940

No. It is not working. – Rauf – 2012-01-17T09:47:39.760

I would definitely consider speaking to your IT department about this. there are a number of GP settings that can change / prevent a user from changing the wallpaper. if they've done this for a reason you could find yourself in hot water for messing around in the registry and changing it. – Joe Taylor – 2012-01-17T10:40:27.397

1

Just save your 'koala' wallpaper over the default wallpaper file your policy is using.

MattPark

Posted 2012-01-16T11:36:04.830

Reputation: 1 061

This file is probably not world-writable, and the OP does not say that he has administrative privileges. – G-Man Says 'Reinstate Monica' – 2015-03-24T12:50:20.670

Worked for me, but you're right, it may not work for him. – MattPark – 2015-03-25T01:27:38.097

0

Have just been trying this. When you copy a user to the default user it keeps a hardcoded path to the originals users themes area so I was trying to change the original users background to a commonly available area.

I found you need to put double backslashes "\\" on the path ie. "C:\\Users\\....." otherwise the .reg entry is ignored!

Darren Phillips

Posted 2012-01-16T11:36:04.830

Reputation: 1

0

Probably not the answer for everyone in every case, but it's worth ruling out: you have to log off and log back in for the setting to take effect. (This is, as others have noted, not going to help if you're fighting GPO, because that is going to set it right back.)

On my Win7 setup, I was setting HKEY_CURRENT_USER\Control Panel\Desktop\Wallpaper to some image and this would do nothing to the actual desktop background, though in Control Panel -> Personalization it would look like the setting had taken hold. This was driving me crazy until I realized that logging out and back in would make the new wallpaper take hold.

Update 9/8: This doesn't answer the OP's question in that it doesn't only use the registry, but as a follow-up, I never did find a satisfactory way to change the wallpaper using just the registry. If you can write and deploy some code, I found that a Win32 call to SystemParametersInfo with the SPI_SETDESKWALLPAPER flag made the wallpaper take effect immediately without the logout/login dance. See this answer for details. Again, it's not going to help if you're battling GPO for control over that setting.

user1454265

Posted 2012-01-16T11:36:04.830

Reputation: 161

You mention the problem having to log out of the user in order to apply the setting, yet if you do that, GPO takes affect but make no mention of how to handle that. – Ramhound – 2015-08-21T19:55:51.697

Sorry, I tried to mention in my answer that this is only helpful when you don't have GPO overriding the setting. – user1454265 – 2015-09-08T14:05:44.400

Also, this may or may not help in your situation, but it's worth following up on - I never did find a satisfactory way to change the wallpaper using only the registry. I ended up settling on a solution that used a Win32 call to SystemParametersInfo. See: http://stackoverflow.com/questions/1061678/change-desktop-wallpaper-using-code-in-net

– user1454265 – 2015-09-08T14:21:55.617

Updated my answer. – user1454265 – 2015-09-08T14:36:32.463

Ramhound: I updated my answer in exactly the way that you asked for, but you deleted your comments and converted to a downvote. Can we talk it out in chat? I'm honestly trying to be helpful here with what little I can contribute. – user1454265 – 2015-09-08T14:45:38.807

The only comments I deleted were those that indicated you should update your answer. Comments are not suppose to be permanent, so I deleted them, because you updated the answer. There is nothing to discuss, so no, we cannot discuss it. An answer that contains the phrase "This doesn't answer the OP's question" is not helpful in my opinion. I will leave it to your imagination to understand the reason I believe, an answer that does not answer the author's question, isn't helpful. Only reason I saw this answer was because of Hansjp's non-answer honestly. – Ramhound – 2015-09-08T14:55:23.127

Fair enough, though I don't know why you asked for me to update it with that information then. I've found many Stack Overflow responses to be helpful that go in a different direction than what the OP was seeking, but which achieve the same or related results, as long as it's clearly called out that this is the case. The downvote's fine, but I'll leave things as they are. – user1454265 – 2015-09-08T15:00:52.483

I indicated you should update your question because you replied to a comment, with a comment, instead of just updating the answer with the relevant information. You can now delete that comment to keep the comment section relevant. – Ramhound – 2015-09-08T15:04:19.957

@Ramhound re: GPO , you could change the security settings for the HKEY_CURRENT_USER\Control Panel\Desktop key so that no-one but you can make changes to it, although that would affect more than just wallpaper. – Sam Hasler – 2017-05-15T07:58:35.227

-1

I realize this is old. I have however had to resolve this very issue, and the way to do it is a bit sneaky.

Set the registry entry to point to the settings you want, then set the permissions on them to allow every one read, but block anyone (including system) from having permissions to change it.

When the GPO goes to process it, it will get an access denied for that specific setting, and you your therefore stuck with the desired settings.

If the file is on your local system, don't use the same file name, unless you also do this trick for the actual image, otherwise the policy may overwrite you file.

Jean-Claude DeMars

Posted 2012-01-16T11:36:04.830

Reputation: 1

1Maybe I need more coffee, but isn't this the opposite of what the question asks about? – fixer1234 – 2018-08-03T00:59:44.003

...and doesn't actually provide a solution, just some explanation. – not2qubit – 2018-12-20T11:54:54.777