Programmatically change wallpaper in Windows 10?

23 ビュー (過去 30 日間)
Kevin
Kevin 2017 年 6 月 14 日
回答済み: JohnGalt 2017 年 6 月 15 日
I guess this can be done in Java. So has anyone figured out calling some java script in MATLAB to do that?
  1 件のコメント
Rik
Rik 2017 年 6 月 14 日
Have a read here. It will greatly improve your chances of getting an answer.

サインインしてコメントする。

回答 (1 件)

JohnGalt
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

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by