Switch Wallpaper-folder


I am new to this forum and to Powershell at all. :wink: So, plz forgive if I ask simple or even stupid questions!

My actuell problem is this:

I have 2 folder with wallpapers (name it folder A and folder B) and I need a Switch to change them. Actually I do it manually (changing background-folder), but I hope, this exercise should be very easy, or do I am wrong?

I searched the web for solutions, but all I found are only scipts to change background-wallpaper to a specific picture or nothing.

Even how to get the actual path to my background-wallpaper-folder is tricky because there is no hint, at which path the “TranscodedWallpaper” is pointing.

So, can someone help me (or is such an inquiry not welcome)?

Welcome to the forum. :wave:t4:

What is it what you actually want to achieve? Why do you need a script for this task? Why don’t you copy the desired pictures to the dedicated folder?

Because these pictures are for different use. And as an ex-devolper I thought to “automatize” these easy task of switching.

The task is:

  • actual displayed folder (for slideshow): folder A
  • double-click prog
  • actual folder changes to folder B
  • prog quits

so, a simple switch.

Ah… you’re an ex-developer. … why “ex”? :thinking:

How would you have accomplished this kind of task as a developer? :wink:

That’s a little bit too abstract. :slight_smile: … where do you think could these kind of setting be stored?

Strange questions… I am an ex-developer (better ex-programmer), because I now do “only” support! I only do programming out of work.

And the information, which folder is used for a wallpaper-slideshow must be stored somewhere - when I start windows it is always the same! :wink:

In my oppinion you should get the path of the wallpaper-folder actually displayed (so folder A oder B) then set it to the opposite folder. Is this so strange? Or difficult (if you know powershell)?

OK, I think I have expressed myself in a somewhat misleading way.

There is no magical command in PowerShell to determine where the setting is which folder the “wallpaper folder” is. But if you know where the setting is it’s very likely very easy to read or to manipulate it.

What I want to say is: we do not deliver ready to use code or solutions on request. But we’d be happy to help you with code you wrote by yourself and got stuck with.

Please use your favorite internet search engine to figure out where Windows saves the setting what folder is used for wallpapers. Probably it’s somewhere in the registry.

If you want to read the registry you can use
and with
you can manipulate already existing settings.

The Problem with Registry-Manipulation is the delay (they normally only take place after reboot).

But if these requests are not welcome here (I wrote it in my opening post) it’s okay.

It’s a PowerShell forum. When we can halp you with your PowerShell code you’re very welcome. :wink:

Hi, welcome to the forum :wave:

This should be simple but it isn’t. The folder is encoded (why?) in a file called slideshow.ini which can be found in:


which expands to:


This is a bit of a hack but it works:
Using Settings | Personalize - set folder A
Rename slideshow.ini to slideshow.a
Using Settings | Personalize - set folder B
This will create a new slideshow.ini file.

Now you have two .ini files with the folders encoded.

I can’t find a ‘proper’ way to trigger the change once the folder updates, but restarting the Explorer process does the trick. So it’s a fairly simple script to switch between folders:

Set-Location "$env:APPDATA\Microsoft\Windows\Themes"
$extension = (Get-ChildItem -Hidden).Extension -replace '\.'
switch ($extension) {
    'a' {
            Rename-Item .\slideshow.ini .\slideshow.b
            Rename-Item .\slideshow.a .\slideshow.ini
    'b' {
            Rename-Item .\slideshow.ini .\slideshow.a
            Rename-Item .\slideshow.b .\slideshow.ini  
Stop-Process -Name Explorer

@matt-bloomfield … hmm … don’t you feel a little like you just did someones homework? :wink: :smiley:

1 Like

[EDIT] Sorry, I did not see, the solution of matt-bloomfield: thanx for that, I will check it later!

@Olaf: someone seems to understand my words “I am new to powershell”! :stuck_out_tongue: