As of my last knowledge update in April 2023, there isn't a direct, built-in command-line tool in Windows 10 specifically designed for changing the desktop background directly to the next image in a slideshow or in the list of backgrounds chosen for random shuffling. The "Next desktop background" option, which is accessible via the desktop context menu when you have a slideshow or multiple pictures selected for your wallpaper, does not have a straightforward CLI equivalent in Windows.
However, you can still achieve this functionality through scripting or by using third-party tools.
Scripting Approach
You could create a PowerShell script that changes the desktop wallpaper by selecting the next image from a specific directory. This script can mimic the "Next desktop background" feature by iterating over a set of images. Here is a simple example to give you an idea:
# Script to change desktop wallpaper to the next image in a directory
# The path to your wallpaper directory
$wallpaperPath = "C:\path\to\your\wallpapers"
# Get all image files from the directory
$images = Get-ChildItem -Path $wallpaperPath -Include @("*.jpg", "*.jpeg", "*.png") -File
# The path where the current wallpaper is stored
$currentWallpaperPath = "C:\path\to\store\currentWallpaper.txt"
# Check if the current wallpaper file exists, and read the current wallpaper
$currentWallpaper = ""
if (Test-Path $currentWallpaperPath) {
$currentWallpaper = Get-Content -Path $currentWallpaperPath
}
# Find the index of the current wallpaper in the images list
$currentIndex = $images.IndexOf($images | Where-Object { $_.FullName -eq $currentWallpaper })
# Determine the next wallpaper index (wrap around if at the end)
$nextIndex = ($currentIndex + 1) % $images.Count
# Set the next wallpaper
$nextWallpaper = $images[$nextIndex].FullName
Set-ItemProperty -Path 'HKCU:\Control Panel\Desktop\' -Name Wallpaper -Value $nextWallpaper
# Apply the changes by calling user32.dll
Add-Type -TypeDefinition @"
using System;
using System.Runtime.InteropServices;
public class Wallpaper {
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni);
}
"@
[Wallpaper]::SystemParametersInfo(20, 0, $nextWallpaper, 3)
# Save the next wallpaper as the current wallpaper
$nextWallpaper | Set-Content -Path $currentWallpaperPath
This script assumes you're cycling through a folder of images. It reads the current wallpaper from a text file, finds the next image in the sequence, updates the registry to change the wallpaper, and calls a system function to refresh the desktop. Modify the paths in the script to match your environment.
Third-party Tools
There are third-party tools designed for desktop customization, including wallpaper management, which might offer more straightforward or feature-complete methods to accomplish this task. Wallpaper Engine and DisplayFusion are popular examples, though they're more comprehensive solutions that go beyond just changing wallpapers.
Please note, always review and test scripts thoroughly in a safe environment before running them, especially those that make changes to your system or registry.