首页 > 系统相关 >如何保存windows聚焦壁纸

如何保存windows聚焦壁纸

时间:2023-02-08 21:05:22浏览次数:66  
标签:Force windows Pictures 聚焦 Item env 壁纸 Spotlight USERPROFILE


1、找到Windows聚焦图片位置:

​C:\Users\你的用户名\AppData\Local\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets​

PS:也可以直接运行里输入:%localappdata%\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets 来打开地址

2、修改文件后缀

将文件后缀名改为.jpg

3、可以用powershell批量提取

新建txt文件另存为​​.ps1​​​用powershell运行即可
图片会保存到图片文件夹中

# 将复制出来的缓存图片保存在下面的文件夹  
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; }
}


标签:Force,windows,Pictures,聚焦,Item,env,壁纸,Spotlight,USERPROFILE
From: https://blog.51cto.com/gwj1314/6044884

相关文章