
Ich muss es beim Start öffnen, um das Hintergrundbild bei Tag und Nacht zu ändern
Dim objShell
str1 = "C:\Users\AnB\Desktop\Texts\Projects\Project WallTime\Day.bat"
str2 = "C:\Users\AnB\Desktop\Texts\Projects\Project WallTime\Night.bat"
Set objShell = Wscript.CreateObject("WScript.Shell")
if hour(time) < 17 then
objShell.Run str1
if hour(time) > 16 then
objShell.Run str2
end if
end if
Dies ist das VBS, das Batchdateien öffnet, die das Reg ändern
Batchdatei für Tag
@echo off
reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d "C:\Users\AnB\Desktop\Texts\Projects\Project WallTime\Day and Night\Day.png" /f
RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters
Batchdatei für Nacht
@echo off
reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v Wallpaper /t REG_SZ /d "C:\Users\AnB\Desktop\Texts\Projects\Project WallTime\Day and Night\Night.png" /f
RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters
aber wenn ich VBS verwende, wird die Registrierung nicht geändert
Bitte helfen Sie
Danke
Antwort1
Habe es geschafft, danke für die Hilfe
@Echo Off
Set "locn=%UserProfile%\Desktop\Texts\Projects\Project WallTime\Day and Night"
Set "rstr=Reg Add "HKCU\Control Panel\Desktop" /V Wallpaper /D "
Set "str1=%locn%\Day.png"
Set "str2=%locn%\Night.png"
Set /A "now=10%TIME:~,2%" 2>Nul
If %now:~-2% Lss 17 (%rstr% "%str1%" /F >Nul
) Else %rstr% "%str2%" /F >Nul
RunDll32 User32.dll,UpdatePerUserSystemParameters >Nul