-
-
Save joaopaulo1511/ed6d42c048fc8906810279117e2eee65 to your computer and use it in GitHub Desktop.
A small PowerShell script to save Windows 10 lock screen images to a more accessible location.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.thewindowsclub.com/use-windows-spotlight-desktop-wallpaper-slideshow | |
# https://onedrive.live.com/?authkey=!ANLOaqn39rJAiok&cid=2813C6E4993C726F&id=2813C6E4993C726F!1507326&parId=2813C6E4993C726F!1507334&o=OneUp | |
$SpotLightFiles = Get-ChildItem $Env:LocalAppData\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets | Where-Object -Property Length -GT 1kb ; | |
# $SpotLightFiles = Get-ChildItem [ System.Environment ]:: GetFolderPath( 'LocalApplicationData' ) \Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets | Where-Object -Property Length -GT 1kb ; | |
If ( $SpotLightFiles ) { | |
$Shell = New-Object -ComObject Shell.Application ; | |
# Destination for pictures | |
$Folder = [ System.Environment ]:: GetFolderPath( 'MyPictures' ) + '\Spotlight' ; | |
If ( -not ( Test-Path -LiteralPath $Folder ) ) { | |
New-Item -Path $Folder -ItemType Directory ; | |
} ; | |
$NameSpace = $Shell.NameSpace( $Folder ) ; | |
$SpotLightFiles | ForEach-Object { | |
$PSItem | Copy-Item -Destination $Folder\$PSItem.jpeg ; | |
Get-Item $Folder\$PSItem.jpeg ; | |
} | ForEach-Object { | |
# $NameSpace = $Shell.NameSpace( $Folder ) ; | |
$Item = $NameSpace.ParseName( $PSItem.Name ) ; | |
$Size = $NameSpace.GetDetailsOf( $Item, 31 ) ; | |
If ( $Size -match '(\d+) x (\d+)' ) { | |
$Width = [ System.Int16 ] ( $Matches[ 1 ] ) ; | |
$Height = [ System.Int16 ] ( $Matches[ 2 ] ) ; | |
} ; | |
If ( -not $Size -or $Width -lt 1920 -or $Height -lt 500 ) { | |
Remove-Item $PSItem ; | |
} ; | |
} ; | |
} ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment