윈도우 자체 추천 이미지 및 Bing Wallpaper (빙 바탕화면 앱을 사용하는 경우) 의 이미지를 바탕화면 이미지 등으로 사용할 수 있도록 한 폴더에 복사해 주는 스크립트 입니다.
다음의 스크립트를 실행하면,
사진 폴더 ( C:\Users\(사용자계정)\Pictures 폴더) 아래의 "Windows Wallpapers" 폴더로
이미지 파일들이 복사 됩니다. (이미 복사된 경우 표시하고 skip)
→ 해당 폴더의 사진을 바탕화면으로 설정하거나 하시면 됩니다.
(바탕화면 자동 변경을 걸어두거나 화면보호기 이미지로 사용하는 등 활용..)
주기적으로 실행하게 하려면 작업 스케쥴러에 스크립트를 설정해주면 될 거 같습니다.
◇ 파일 생성 : extract_spotlight.ps1
→ (저의 경우 C:\Users\(사용자계정)\Pictures 폴더 아래에 만들었습니다)
$ErrorActionPreference = "Continue"
$wallpaperPath = "$env:USERPROFILE\AppData\Local\Packages\MicrosoftWindows.Client.CBS_cw5n1h2txyewy\LocalCache\Microsoft\IrisService"
$lockscreenPath = "$env:USERPROFILE\AppData\Local\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets"
$bingwallpaperPath = "$env:LOCALAPPDATA\Packages\Microsoft.BingWallpaper_8wekyb3d8bbwe\LocalState\images"
$destination = "$env:HOMEPATH\Pictures\Windows Wallpapers"
if (!(Test-Path $destination)) { New-Item -ItemType Directory -Path $destination -Force }
Write-Host "Saving Wallpaper Spotlight images..."
Get-ChildItem -Path $wallpaperPath -Recurse -File -ErrorAction SilentlyContinue| Where-Object { $_.Length -gt 200000 } | ForEach-Object {
# 파일명에 .jpg가 포함되어 있는지 확인
$baseName = $_.Name
if ($baseName -notlike "*.jpg") {
$baseName = "$baseName.jpg"
}
$newName = Join-Path $destination ("Wallpaper_$baseName")
if (-not (Test-Path $newName)) {
try {
Copy-Item -Path $_.FullName -Destination $newName -Force -ErrorAction Stop
Write-Host "Copied:" $newName
} catch {
Write-Warning "Failed to copy $($_.FullName) -> $newName : $($_.Exception.Message)"
}
} else {
Write-Host "Already exist:" $newName
}
}
Write-Host "Saving Lock Screen Spotlight images..."
Get-ChildItem -Path $lockscreenPath -File -ErrorAction SilentlyContinue | Where-Object { $_.Length -gt 200000 } | ForEach-Object {
# 파일명에 .jpg가 포함되어 있는지 확인
$baseName = $_.Name
if ($baseName -notlike "*.jpg") {
$baseName = "$baseName.jpg"
}
$newName = Join-Path $destination ("Lockscreen_$baseName")
if (-not (Test-Path $newName)) {
try {
Copy-Item -Path $_.FullName -Destination $newName -Force -ErrorAction Stop
Write-Host "Copied:" $newName
} catch {
Write-Warning "Failed to copy $($_.FullName) -> $newName : $($_.Exception.Message)"
}
} else {
Write-Host "Already exist:" $newName
}
}
Write-Host "Saving Bing-Wallpaper Spotlight images..."
Get-ChildItem -Path $bingwallpaperPath -Include *.jpg -Recurse -File -ErrorAction SilentlyContinue | Where-Object { $_.Length -gt 200000 } | ForEach-Object {
# 파일명에 .jpg가 포함되어 있는지 확인
$baseName = $_.Name
if ($baseName -notlike "*.jpg") {
#$baseName = "$baseName.jpg"
continue
}
$newName = Join-Path $destination ("BingWallpaper_$baseName")
if (-not (Test-Path $newName)) {
try {
Copy-Item -Path $_.FullName -Destination $newName -Force -ErrorAction Stop
Write-Host "Copied:" $newName
} catch {
Write-Warning "Failed to copy $($_.FullName) -> $newName : $($_.Exception.Message)"
}
} else {
Write-Host "Already exist:" $newName
}
}
Write-Host "All Spotlight images have been saved to: $destination"
ps 를 쉽게 실행하기 위해 같은 폴더에 bat 파일도 만들어줍니다
다음의 내용으로 windows_wallpaper.bat 파일 생성
@echo off powershell -ExecutionPolicy Bypass -File extract_spotlight.ps1 > pause
( "> pause" 앞의 > 기호를 지우면, 실행 후 화면에서 기다립니다)
실행하면 다음과 같이 “사진” 폴더 아래에 Windows Wallpapers 폴더에 윈도우 이미지가 복사됩니다.
powershell -ExecutionPolicy Bypass -File extract_spotlight.ps1
Saving Wallpaper Spotlight images...
Copied: \Users\user\Pictures\Windows Wallpapers\Wallpaper_133859917908914354.jpg
Saving Lock Screen Spotlight images...
Copied: \Users\user\Pictures\Windows Wallpapers\Lockscreen_29dbe3e0a1823642f4a04e804e1009f093a3efdc257e9d1ebe9d46000e32fb75.jpg
Saving Bing-Wallpaper Spotlight images...
Copied: \Users\user\Pictures\Windows Wallpapers\BingWallpaper_20260813_OHR.PerseidasTenerife_ROW7214052413_UHD_bing.jpg
All Spotlight images have been saved to: \Users\user\Pictures\Windows Wallpapers
반복되는 부분이 있어서 단순화 할 수 있으나, 개인적인 사용에는 무리가 없어서 그냥 두었습니다.
깔끔하게 다듬어서 사용하시거나 해도 될 거 같아요.
(대상 이미지 경로가 정보의 전부나 마찬가지일 정도로)
단순한 파일 복사 내용이므로 우려할 만한 사항은 없으나,
이것도 스크립트인 관계로 악성 코드 등 내용이 걱정되는 경우,
내용을 살펴 보시고 사용하시는 것을 추천 드립니다.