怎样自动把Windows聚焦设为壁纸

2024-10-14 07:17:31

1、新建一个文本文档,把这段代码复制到里面。add-type -AssemblyName System.DrawingNew-Item "$($en即枢潋雳v:USERPROFILE)\Pictures\Spotlight" -ItemType directory -Force;New-Item "$($env:USERPROFILE)\Pictures\Spotlight\CopyAssets" -ItemType directory -Force;New-Item "$($env:USERPROFILE)\Pictures\Spotlight\Horizontal" -ItemType directory -Force;New-Item "$($env:USERPROFILE)\Pictures\Spotlight\Vertical" -ItemType directory -Force;foreach($file in (Get-Item "$($env:LOCALAPPDATA)\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets\*")){ if ((Get-Item $file).length -lt 100kb) { continue } Copy-Item $file.FullName "$($env:USERPROFILE)\Pictures\Spotlight\CopyAssets\$($file.Name).jpg";}foreach($newfile in (Get-Item "$($env:USERPROFILE)\Pictures\Spotlight\CopyAssets\*")){ $image = New-Object -comObject WIA.ImageFile; $image.LoadFile($newfile.FullName); if($image.Width.ToString() -eq "1920") { Move-Item $newfile.FullName "$($env:USERPROFILE)\Pictures\Spotlight\Horizontal" -Force; } elseif($image.Width.ToString() -eq "1080") { Move-Item $newfile.FullName "$($env:USERPROFILE)\Pictures\Spotlight\Vertical" -Force; }}Remove-Item "$($env:USERPROFILE)\Pictures\Spotlight\CopyAssets\*";2

怎样自动把Windows聚焦设为壁纸

2、把这个文件的后缀改为ps1,名字随便,这里就叫save-spotlight.ps1。

怎样自动把Windows聚焦设为壁纸怎样自动把Windows聚焦设为壁纸

4、桌面右键-个性化,选择幻灯屡阽咆忌片放映,在单击浏览,选择C:\Users\你的用户名\Pictures\Spotlight\Horizontal。再设就女蒿鸳置好多久换一次图片。如果没有这个文件夹,多运行几次刚才写的程序。

怎样自动把Windows聚焦设为壁纸

6、开机出现这个窗口就OK了,它会自动保存Windows聚焦的图片并设为壁纸。

怎样自动把Windows聚焦设为壁纸

7、在power shell(管理员)中输入Set-ExecutionPolicy Unrestricted,在输入y,否则脚本无效

猜你喜欢