Change desktop wallpaper using shortcut?

NG7

Commendable
Apr 24, 2016
15
0
1,520
I was wondering whether there is a way to change the desktop background using a shortcut.

I created shortcuts on my desktop to the different battery modes on my laptop for easier and quicker access. I was hoping that when I, for example, select the gaming battery mode, the shortcut would change the battery mode as well as my wallpaper to a certain picture whereas if i were to select the power saving battery mode, it would change the battery mode and the wallpaper to another picture.

Is this possible? Any suggestions would be greatly appreciated, even if they require vbs scripts or similar.

Thanks in advance
 
Solution
Hmm, that might not work in certain versions of windows, not 100% sure.

VBScript to edit the registry value should be pretty straight forward as well.

Eximo

Titan
Ambassador
Powershell should be useful, you can control most windows functions with it.

create a text file and change the extension to .ps1 and add this to it:

Function Set-WallPaper($Value)

{

Set-ItemProperty -path 'HKCU:\Control Panel\Desktop\' -name wallpaper -value $value

rundll32.exe user32.dll, UpdatePerUserSystemParameters

}
 

NG7

Commendable
Apr 24, 2016
15
0
1,520


hmm ok, i'll try. Where do i include the location of the wallpaper file? instead of 'name wallpaper'?
 

NG7

Commendable
Apr 24, 2016
15
0
1,520
I managed to create a vbs script as follows:


Dim shell : Set shell = CreateObject("WScript.Shell")
Dim wallpaper : wallpaper = "C:\Users\nigel\Desktop\Wallpapers\ocean sunrise.jpg"

shell.RegWrite "HKCU\Control Panel\Desktop\Wallpaper", wallpaper

shell.Run "%SYSTEMROOT%\System32\rundll32.exe user32.dll,UpdatePerUserSystemParameters", 1, True


Thanks for the help once again Eximo
 

Eximo

Titan
Ambassador
That is a function, so to call it you would write Set-WallPaper -value "Path to file"

If you are doing this in powershell you would have to add your code to change the battery settings.

Google is your friend when it comes to powershell, a very powerful tool.

I'm trying to figure out why it doesn't seem to work on this 8.1 install. So far it looks like the path isn't quite correct.

Should be HKEY_USERS\"UserProfile"\Control Panel\Desktop

But changing that doesn't seem to work either. The commands are still valid, just can't seem to get powershell to locate the path.
 

NG7

Commendable
Apr 24, 2016
15
0
1,520
i figured that a vbs script would be simpler than powershell.. (i may be wrong, i have pretty much 0 knowledge in coding with those systems) so i looked up a script on google, found one and tweaked it to suit my needs. Im currently trying to figure out how to make a vbs script that will run the wallpaper changer vbs and the power mode shortcut... still getting an error when trying to run it though, google save me please

 

TRENDING THREADS