Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gets all Windows Spotlight wallpaper images from the cache and saves them to the user's profile.
@ECHO OFF &SETLOCAL
REM
REM This batch file can attempt to detect app icons and other files that are not
REM Windows Spotlight wallpapers using MediaInfo CLI to examine the height and width.
REM
REM If MediaInfo is not found, this script will remove some common files manually.
REM
REM MediaInfo CLI can be downloaded and installed in any Path directory.
REM
REM https://sourceforge.net/projects/muldersoft/files/MediaInfo%20%28CLI%2BGUI%29/
REM
:BEGIN
REM Check for Windows 10
for /f "tokens=4-5 delims=. " %%i in ('ver') do set VERSION=%%i.%%j
if "%version%" == "6.0" echo Windows Vista detected
if "%version%" == "6.1" echo Windows 7 detected
if "%version%" == "6.2" echo Windows 8 detected
if "%version%" == "6.3" echo Windows 8.1 detected
if "%version%" == "10.0" echo Windows 10 detected
ECHO %i
IF %i LSS 10 (
ECHO This file is intended for use on Windows 10.
PAUSE
EXIT /B 1
)
CLS
MKDIR "%userprofile%\Desktop\TempImages" && COPY "%userprofile%\AppData\Local\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets\*" "%userprofile%\Desktop\TempImages\*.jpg" >NUL && GOTO DELETEFILES
PAUSE
EXIT /B 2
:DELETEFILES
REM Delete app icons
PUSHD "%userprofile%\Desktop\TempImages"
MEDIAINFO --help >NUL
IF %ERRORLEVEL% NEQ 0 GOTO MANUALDELETE
ECHO Processing Images...
for /r %%a in (*.jpg *.bmp *.png) do (
set "width="
set "height="
for /f "tokens=1*delims=:" %%b in ('"MEDIAINFO --INFORM=Image;%%Width%%:%%Height%% "%%~a""') do (
REM echo(%%~a %%~b %%~c
IF /I %%~b LSS 1000 (
DEL %%~a 2>NUL
)
)
)
GOTO CONTINUE
:MANUALDELETE
ECHO Removing manually
DEL 0150965e1ace000139d39799567eacbb327039e75b0bb31114626f33c2fb3c77.jpg 2>NUL
DEL 0167948d52fa0938a5a4bb0f4cbfdb856e07951ff4b88ea602190c137e8f5cbd.jpg 2>NUL
DEL 0bfb6f414d22b5f7fc1fb8c87b0219721db470f61612e478332bfe5a9165551e.jpg 2>NUL
DEL 0e49670dd118ceb2ecd77f9e51634c699cc7d75e75b285d12bfb662a433dbba1.jpg 2>NUL
DEL 11b1cf6489254d49fee1b93f2f9c6997b92b91bae8fe4dcead722684c818c175.jpg 2>NUL
DEL 147e3ef74b7d92b27b83cfa946692109fdb529b845656181e3bccc38d447c0b6.jpg 2>NUL
DEL 24198b27d057b958cfbd6aa699ceff733de4447885f3f1c8408cad2fbf2cb03d.jpg 2>NUL
DEL 2625221192c134d5d0dc95a1cbaf856dac2756d2e56cd0890eacb6b29f2bc5e7.jpg 2>NUL
DEL 2cad6ab7697cb65703b03d91bec75d97376d32ba16c27beadf4ecd2e83d31dc3.jpg 2>NUL
DEL 2f3f200650471d762c51baf6ebe68d697bf22ceb67aa12fb43358563adea8b9d.jpg 2>NUL
DEL 2f45584e22d60c4cff48104ea092be750d552b4e54546d778d04d1db9fdf9b9d.jpg 2>NUL
DEL 2f9ba805f8191e6e5906eb9d9b1ee50ea4ef7ce1cfaeb8382b147f6b3223823d.jpg 2>NUL
DEL 33f0e90fd378d46b07549a90da51d6d29f4644380ad48a9e707de80ffd9c234e.jpg 2>NUL
DEL 37a99ecbeeab90c533604f37cec349cfc97192a0abd399e1574424bf9d1cdf7d.jpg 2>NUL
DEL 43cf718e20b89233ccd3856cab92736f301f4b5444f1db704562011b02fc73f8.jpg 2>NUL
DEL 452119801329f0197cb56c377d5ebcc07e4e388c13cb2e24524f1d89614ca5d1.jpg 2>NUL
DEL 46dd2eace740bf21c65cb32325cfe028524c66c576bff3c920bcf2a45b3cc67f.jpg 2>NUL
DEL 4a25b4a398fdb80b804a56456ce5a1ab7aa60d3485045a2fe166b18d0e0f09cf.jpg 2>NUL
DEL 4fafc7ca4af50c9817053f2233923fd73a47d6aa6c64c3b3ab9bf39f79984d62.jpg 2>NUL
DEL 5254cdc89e00054b03d6fe4acb790171cfde9ef2adf276d0a1146ecc1a2c4746.jpg 2>NUL
DEL 581003d170c863a12208618cf4b7f04417191983d0a4ee49592aed97cb66893d.jpg 2>NUL
DEL 6ce5241632a16d5c8868d154ff2373ad3caae1a22cae86537d1f8cf201bf8b7b.jpg 2>NUL
DEL 871991655f2dc1d3a8768d754fbf3c59d4f0edb901b9743eb37ebb7a3661f672.jpg 2>NUL
DEL 8817a44b94fc501260229cce02a750069ba79ecb0f973cb1cac9a41e4521342e.jpg 2>NUL
DEL 8b0ce870bcae644795f0edfe6d0f74b6be66da2f96b86b93b6bfc1b9030181bb.jpg 2>NUL
DEL 91b8c45f53bd0c2e8087f972b2d639dab043ddaff133ae95d2bfe4d93b923605.jpg 2>NUL
DEL 96930684d242048e9ee8ffee9637d3e5f7134ca9f9edcacfffd0d1b5f3f69417.jpg 2>NUL
DEL 96db593ab80922a29e69b8962de3500d13db0713ecfd27cc83176669a9323e9a.jpg 2>NUL
DEL 9d97c0789c1a62b14031c0918cbc04eaebf6046b4c3ea9f0874d1346929b6889.jpg 2>NUL
DEL 9ea30248c4aaa7307fb592ed9e380e1aabe168319cb9382464714fb9307eb908.jpg 2>NUL
DEL a1c8acb069eda5b9852d7c79348c73767cd8732242ced9ea7f6b6ca38337f890.jpg 2>NUL
DEL a22b3b8f29a4c2ae6fac0b0dd9268e8fa42f44317b21c04540e371828846dbad.jpg 2>NUL
DEL a6f3e6613a7cb90b1cfbd6befaec9a80a2c28cf3f83f6fcbb6ceded1448b8c57.jpg 2>NUL
DEL aba6037df067d5e2e1bca330bf8b16c8d99ae3f9f382a755db289d447fa569c4.jpg 2>NUL
DEL ad4b9ec428b1dbe8c312d23cd6c31d0023ef613db712f99459ae6b8b072ae557.jpg 2>NUL
DEL b5f6d04e51aff23557224db3113c1f623d1702e57cc65c3bb91274bcc06ea7b8.jpg 2>NUL
DEL be2b786bcce71cd60ab282fe703829b1c2f9fa947389ee3505353d9a90a11b2b.jpg 2>NUL
DEL c3962dd1c4b4f3917ffab15400542328547055efa4ca0b76619086e03b962a28.jpg 2>NUL
DEL d1a7c7769f26069029042b3ce293787306aaef869f71b45a7bfc693ae4340644.jpg 2>NUL
DEL d5c60f5d9f7e9a51551b809b693b04ddb0416b55532932aaa95eec1ab9b11c97.jpg 2>NUL
DEL e9ddb8e9ad7ba1c94bfda88bf8007716d3c245d9fecbd6c8efb88c601df1cf2a.jpg 2>NUL
DEL edde9c4db71bb763c29bda354364c52b83169c51a930b01c2ba995fdc9589bee.jpg 2>NUL
DEL f20fd40c276d927fb82ff903d6b9026184fa5c1f5a2df385ae879356e168aed7.jpg 2>NUL
DEL f853c7f9f4310fb84ed51f0f37773759d786c6240b674aa9b3a97c1b4812dc83.jpg 2>NUL
:CONTINUE
POPD
EXPLORER.EXE "%userprofile%\Desktop\TempImages"
PAUSE
:PROMPT
CLS
CHOICE /C YN /N /T 25 /D Y /M "Move these photos to your profile folder ([Y]/N)? "
IF ERRORLEVEL 255 GOTO ERROR
IF ERRORLEVEL 2 GOTO END
IF ERRORLEVEL 1 GOTO COPYFILES
IF ERRORLEVEL 0 GOTO END
:PROMPT2
CLS
SET /P KEEPFILES=Keep these photos (Y/[N])?
IF /I "%KEEPFILES%" NEQ "Y" GOTO END
GOTO COPYFILES
:COPYFILES
COPY /Y "%userprofile%\Desktop\TempImages\*.jpg" "%userprofile%\Pictures\Spotlight" >NUL
GOTO END
:ERROR
ECHO An error has occurred.
PAUSE
GOTO END
:END
taskkill /FI "IMAGENAME eq explorer.exe" /FI "WINDOWTITLE eq TempImages" >NUL
RMDIR /S /Q "%userprofile%\Desktop\TempImages\"
CLS
ENDLOCAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.