set-itemproperty -path "HKCU:Control Panel\Desktop" -name WallPaper -value Zapotec.bmp
我发现这个代码在线PowerShell的为Windows 7,但我想要的壁纸设置为存储从浏览器访问Web服务器的文件。我将如何去做这件事。PowerShell的 - 更改Windows 7的背景图像关闭网站
set-itemproperty -path "HKCU:Control Panel\Desktop" -name WallPaper -value Zapotec.bmp
我发现这个代码在线PowerShell的为Windows 7,但我想要的壁纸设置为存储从浏览器访问Web服务器的文件。我将如何去做这件事。PowerShell的 - 更改Windows 7的背景图像关闭网站
我试图改变我的壁纸与你的命令,但它没有工作,直到我遇到这样的:RUNDLL32.EXE user32.dll中,UpdatePerUserSystemParameters。即使那样,它只能间歇性地工作(这是Win7上的一个知识问题)。
不管怎么说,我已经写了PowerShell中GETFILE功能下载一个源网址到磁盘。
function getfile($url, $filename)
{
$wc = New-Object System.Net.WebClient
Register-ObjectEvent -InputObject $wc -EventName DownloadProgressChanged -SourceIdentifier WebClient.DownloadProgressChanged -Action { Write-Progress -Activity "Downloading: $($EventArgs.ProgressPercentage)% Completed" -Status $url -PercentComplete $EventArgs.ProgressPercentage; }
Register-ObjectEvent -InputObject $wc -EventName DownloadFileCompleted -SourceIdentifier WebClient.DownloadFileComplete -Action { Write-Host "Download Complete - $filename"; Unregister-Event -SourceIdentifier WebClient.DownloadProgressChanged; Unregister-Event -SourceIdentifier WebClient.DownloadFileComplete; }
try
{
$wc.DownloadFileAsync($url, $filename)
}
catch [System.Net.WebException]
{
Write-Host("Cannot download $url")
}
finally
{
$wc.Dispose()
}
}
你可以找到它,并用它做什么的详细说明以及简化版本here。
你应该能够与一些这样的事来改变你的壁纸:
$url = "http://fc05.deviantart.net/fs30/f/2008/062/9/4/Serenity_WPP3___1920_Preview_by_nuaHs.jpg"
$filename = "d:\serenity.jpg"
getfile $url $filename
set-itemproperty -path "HKCU:Control Panel\Desktop" -name WallPaper -value $filename
rundll32.exe user32.dll, UpdatePerUserSystemParameters
我很肯定你不能这样做。墙纸图片必须在本地存储。当你在浏览器中右键单击图像并“设置为壁纸”时,它将被复制到硬盘上。
我想你有2个选择。
有无PowerShell的本地下载的文件和使用的P/Invoke调用SystemParametersInfo函数在User32.dll中设置壁纸。 API将设置它并立即激活更改。 Here's an example这样做。
使用RSS壁纸主题。您可以编辑一个.theme文件并指定您自己的RSS网址,但是该Feed URL需要为像this one这样的图像提供媒体项目。您可以下载this theme file并使用您的RSS提要URL进行编辑。