@echo off

set LISTFILE=apps.txt
set APPSFOLDER=storeapps

IF NOT EXIST %LISTFILE% (
  echo ERROR: %LISTFILE% not found!
  exit /b
)

echo using list [ %LISTFILE% ] ...
mkdir %APPSFOLDER% 2>nul

echo ================================================
echo START download of APPS from SOURCE sites ... 
echo ================================================
date /t
time /t
echo.

FOR /F "tokens=1" %%E in (%LISTFILE%) do (
  echo URL = [ %%E ]
  powershell -command .\Download-AppxFromStore.ps1 %%E %APPSFOLDER%
  echo.
)

echo Cleanup ...
del /F /Q %APPSFOLDER%\*.BlockMap
del /F /Q %APPSFOLDER%\*x86*
del /F /Q %APPSFOLDER%\*arm*
del /F /Q %APPSFOLDER%\*.eappxbundle
del /F /Q %APPSFOLDER%\*.emsixbundle

echo.
date /t
time /t
echo ======
echo READY.
echo ======

