What command in command prompt changes folder path in slideshow?

Igor Duarte 1 Reputation point
2022-02-09T00:58:04.787+00:00

I have more technical questions related to programming

I would like to know more about commands in the command prompt, because I wanted to run a command that changes the slideshow path in Windows, but using the command prompt.

I'm wanting to use a command in the command prompt that changes the background image (image on the desktop) but with a path in a folder on the network and for that I have to go to settings and change to slideshow and look for the path.

But I would like to do this with a command in the command prompt without having to go manually. I looked it up on the internet and found it related but nothing helped me as it doesn't do exactly what I need.

And I've already used this command (reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d \pastarede\image.jpg /f) which changes the desktop image but doesn't work as a Windows 10, because if I change the image in the network folder it will not change later on the pc, because the command only takes the image and changes the desktop image and does not leave it as the Windows 10 slideshow function that it keeps the image path and any changes or if I add more images it changes automatically.

Is there a command in CMD that I can do this?

It can even be in powershell, I'll leave the command saved in a .bat file or in ps1 in the case of powershell because then I'll only execute it with one click.

Small BASIC
Small BASIC
A programming language created by Microsoft that serves a stepping stone for beginners from block-based coding languages to more complex text-based languages.
280 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Nonki Takahashi 676 Reputation points
    2022-02-18T23:36:43.747+00:00

    @Igor Duarte , FYI: I couldn't find the original source article but this is a copy from https://thinline196.hatenablog.com/entry/2019/05/02/004823. Sorry I didn't test this script yet.

    $setwallpapersource = @"  
    using System.Runtime.InteropServices;  
    public class wallpaper  
    {  
    public const int SetDesktopWallpaper = 20;  
    public const int UpdateIniFile = 0x01;  
    public const int SendWinIniChange = 0x02;  
    [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]  
    private static extern int SystemParametersInfo (int uAction, int uParam, string lpvParam, int fuWinIni);  
    public static void SetWallpaper ( string path )  
    {  
    SystemParametersInfo( SetDesktopWallpaper, 0, path, UpdateIniFile | SendWinIniChange );  
    }  
    }  
    "@  
      
    Add-Type -TypeDefinition $setwallpapersource  
    [wallpaper]::SetWallpaper("image path")  
    

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.