I like how certain Windows themes rotate through various images, but I also like to use BgInfo to write out various machine info to the desktop wallpaper image.
I created a customized BGI file and pointed it to current.jpg
in a folder. Then I wrote a powershell script to copy a random image in that folder to the current.jpg
and then execute the BgInfo command-line options to update the wallpaper:
Get-ChildItem -Path $Env:USERPROFILE\Pictures\wallpaper\* -Include *.* -Exclude current.jpg | Get-Random | Foreach-Object { Copy-Item -Path $_ -Destination $Env:USERPROFILE\Pictures\wallpaper\current.jpg }
D:\utils\SysinternalsSuite\Bginfo.exe $Env:USERPROFILE\Documents\custom.bgi /NOLICPROMPT /timer:0
This works great. However, when I setup a scheduled task to execute this script every thirty minutes a powershell window would flash on the screen, briefly. I had seen solutions that use a VBS file to execute commands, so I tried that:
Dim shell,command
command = "powershell.exe -NoLogo -NonInteractive -WindowStyle Hidden -File D:\utils\select-random-wallpaper.ps1"
set shell = CreateObject("WScript.Shell")
shell.Run command,0
I no longer see a brief console window, but it still will activate the foreground app in weird ways. Like if I am using Chrome, it will switch the current active Chrome window to a different one.
Am I doing something wrong? How do I schedule a task without having it affect foreground applications?
Edit: Related to it being BgInfo-specific, any idea if BgInfo's source is available anywhere? The bug's been around since 2007 and it hasn't even been updated since 2013.