可以用 PowerShell 写一个自动获取 Bing 壁纸的脚本,然后任务计划每天定时执行。
http://www.pstips.net/set-wallpaper-by-bing-image.html我简单改写了一下:
参数$num:0-7,表示从当天开始$num 天之前。0 代表当天,1 代表前一天,以此类推
参数$mkt:国家代码,比如 zh-cn,en-us,ja-jp 等等,不同国家的壁纸可能有区别
----------------------------------------------------------------------------------------
function Save-BingTodayImage($num, $mkt)
{
#必应图片故事 API
$bingImageApi ='
http://global.bing.com/HPImageArchive.aspx?format=js&idx=' + $num + '&n=1&mkt=' + $mkt
Write-Host "$bingImageApi"
$bingUri = '
http://www.bing.com/' # 获取图片链接
$bingImageJsonOrg = (Invoke-WebRequest -Uri $bingImageApi).Content | ConvertFrom-Json
$bingImageJson = $bingImageJsonOrg.images[0]
Write-Host "$num"+"$mkt"
Write-Host "$mkt"
Write-Host "$( $bingImageJson.copyright ) "
$imgLink = '{0}{1}' -f $bingUri , $bingImageJson.url
# 下载和保存图片
$imageDir = "$HOME\Pictures\Bing\"
if( -not (Test-Path $imageDir) )
{
mkdir $imageDir | Out-Null
}
$imageFile = Join-Path $imageDir ( $bingImageJson.enddate + ', {0}.jpg' -f ($bingImageJson.copyright -replace("[\\/?]{1,}","@") -replace("[:]{1,}","")))
Invoke-WebRequest -Uri $imgLink -OutFile $imageFile
return $imageFile
}
# 获取今日必应背景图片
Write-Host $args[0]
Write-Host $args[1]
$image=Save-BingTodayImage $args[0] $args[1]
----------------------------------------------------------------------------------------