|
本帖最后由 2012sdta1541 于 2025-2-11 17:28 编辑
从隔壁论坛看到的,Windows11和10中使用正常。
@ECHO OFF&(PUSHD "%~DP0")&(REG QUERY "HKU\S-1-5-19">NUL 2>&1)||(
powershell -Command "Start-Process '%~sdpnx0' -Verb RunAs"&&EXIT)
::批处理已提权
::设置图片桌面
powershell -Command "& {Add-Type -TypeDefinition 'using System; using System.Runtime.InteropServices; public class Wallpaper { [DllImport(\"user32.dll\", CharSet = CharSet.Auto)] public static extern int SystemParametersInfo (int uAction, int uParam, string lpvParam, int fuWinIni); public static void SetWallpaper(string path) { SystemParametersInfo(20, 0, path, 3); }}'; [Wallpaper]::SetWallpaper('C:\Users\Administrator\Desktop\重装\壁纸.jpg');}"
保存为批处理格式运行
|
|