- @echo off
- set RegPath="HKEY_CURRENT_USER\Control Panel\Desktop"
-
- :: 获取壁纸路径
- for /f "tokens=2,* skip=4" %%a in ('reg query %RegPath% /v wallpaper') do set img=%%b
-
- :: 添加计算机名到壁纸上,输出为新图片
- nconvert -text_flag top-center -text_font system 30 -text "%ComputerName%" -out bmp -o "%temp%\wallpaper.bmp" -overwrite "%img%"
-
- :: 修改桌面背景
- reg add %Regpath% /v wallpaper /d "%temp%\wallpaper.bmp" /f
- RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters
复制代码 方法是将计算机名添加到壁纸上。需下载 nconvert.exe。
添加文字的参数:
-text string : Add a text
-text_font name size : Font name and size
-text_color r g b : Text color
-text_back r g b : Text background color
-text_flag pos : Position of text
top-left, top-center, top-right
center-left, center, center-right
bottom-left, bottom-center, bottom-right
-text_pos x y : Position or offset |