Programmatically change wallpaper in Windows 10?
6 次查看(过去 30 天)
显示 更早的评论
回答(1 个)
JohnGalt
2017-6-15
this can be done with a '.cmd' file... which can be executed from the matlab command window using 'system()' ... this starts by copying the wallpaper using 'copy "new_Wallpaper.jpg" "C:\Wallpaper.jpg"' - this is a snippet of code I found online and I can't seem to find the original to give it proper credit... anyway:
@ECHO OFF
:: Paste the wallpaper, desired, due to its extension (type bmp or jpg), for an own folder within it. Do not modify the name of the desired file
copy "new_Wallpaper.jpg" "C:\Wallpaper.jpg"
:: Add the required values ​​to the registry, if these people are using a System Wallpaper. If they have always modified their wallpapers, the following lines are not necessary. "They have no habit of hurting themselves, constantly"
REG ADD "HKCU\Control Panel\Desktop" /V Wallpaper /T REG_SZ /F /D "C:\Wallpaper.jpg"
:: Modify the following line in the last number to 0 if you want to center the bitmap on the desktop. Change the last number in the following line to 2 if you wish to extend the bitmap vertically and horizontally to fit on your desktop.
REG ADD "HKCU\Control Panel\Desktop" /V WallpaperStyle /T REG_SZ /F /D 0
:: Change to 0 (zero), the last number not to "pave" the image, set it to A (1) will be tiled.
REG ADD "HKCU\Control Panel\Desktop" /V TileWallpaper /T REG_SZ /F /D 0
:: The following lines energize desktop
%SystemRoot%\System32\RUNDLL32.EXE user32.dll, UpdatePerUserSystemParameters
::The following line locks (locks) the workstation (server).
::%SystemRoot%\System32\RUNDLL32.EXE user32.dll, LockWorkStation
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 File Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!