VB Script to change desktop wallpaper on startup

断了今生、忘了曾经 提交于 2019-12-30 11:49:20

问题


Due to some mardy users voting down my last one, I'll change the question.

I want to create a VBScript, or whatever method you deem possible to do so. That sets the desktop background to a desired image on PC startup.

Anybody shed light on how to do so Would running a powershell script be better suited to do so or?

I work mainly with C# and .NET technologies, so this is kind of out my area


回答1:


I'm not sure if it is the best option. But you could edit the registry entry that is responsible for your background and update the necessary parameter.

Save the following in a bat file and put it into auto-start.

@echo off
reg add "HKCU\control panel\desktop" /v wallpaper /t REG_SZ /d "" /f 
reg add "HKCU\control panel\desktop" /v wallpaper /t REG_SZ /d "C:\[LOCATION OF WALLPAPER HERE]" /f 
reg delete "HKCU\Software\Microsoft\Internet Explorer\Desktop\General" /v WallpaperStyle /f
reg add "HKCU\control panel\desktop" /v WallpaperStyle /t REG_SZ /d 2 /f
RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters 
exit

All Credits to Tim

Kind Regards spitterfly




回答2:


If you wanted to do it through Powershell you could follow the instructions Here

The meat of it is you can preform this task by a simple command

Set-Wallpaper [Source] [Selection]

Now this can be achieved by pre-loading the Set-Walpaper.ps1 that was written by "TheAgreeableCow" and the code can be found on GITHUB



来源:https://stackoverflow.com/questions/30210365/vb-script-to-change-desktop-wallpaper-on-startup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!