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

 时间:2026-02-12 06:14:53

1、新建一个文本文档,把这段代码复制到里面。

add-type -AssemblyName System.Drawing

New-Item "$($env: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聚焦设为壁纸

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

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

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

3、接下来修改文件打开方式,因为.ps1文件默认打开方式是记事本,我们把它改成Windows PowerShell。右键-打开方式,单击更多应用,勾上始终使用此程序打开.ps1文件,单击在这台电脑上查找其他应用,按照这个路径选择Windows PowerShell:C:\Windows\System32\WindowsPowerShell\v1.0\WindowsPowerShell。

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

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

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

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

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

5、接下来要让它自动运行。我们创建一个刚才写的程序的快捷方式(一定要快捷方式)到这个文件夹C:\ProgramData\Microsoft\Windows\[开始]菜单\程序\启动。

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

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

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

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

  • 怎么找到Windows聚焦图片并设置为壁纸
  • win10下载的离线地图在哪?
  • 树莓派如何添加应用文件夹?
  • ToDesk配置windows键的方法
  • 电脑中怎么删除用户的变量?
  • 热门搜索
    安徽旅游论坛 象山影视城旅游 乡村旅游规划 长白山旅游团 酒店旅游 大连圣亚旅游控股股份有限公司 淘宝旅游 巴马旅游 厦门鼓浪屿旅游景点 河北旅游地图