@echo off

echo Checking for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"

echo Permission check result: %errorlevel%

REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )

:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"

echo Running created temporary "%temp%\getadmin.vbs"
timeout /T 2
"%temp%\getadmin.vbs"
exit /B

:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0" 

echo Batch was successfully started with admin privileges
echo .
cls

Title Windows Store Installer
echo --------------------------------------------------
echo Quelle https://www.deskmodder.de/blog/2022/03/03/windows-11-22567-iso-esd-deutsch-english/ 
echo -
echo store.rg-adguard.net aufrufen 
echo -
echo Auf ProductID umstellen / 9wzdncrfjbmp / Retail, Slow, Fast ist egal / Haken anklicken. 
echo Jetzt 
echo Microsoft.NET.Native.Framework.2.2_2.2.29512.0_x64 8wekyb3d8bbwe.appx 
echo Microsoft.NET.Native.Runtime.2.2_2.2.28604.0_x64 8wekyb3d8bbwe.appx 
echo Microsoft.UI.Xaml.2.7_7.2109.13004.0_x64 8wekyb3d8bbwe.appx 
echo Microsoft.VCLibs.140.00_14.0.30704.0_x64 8wekyb3d8bbwe.appx 
echo Per Rechtsklick speichern unter herunterladen 
echo -
echo Dann noch die Microsoft.WindowsStore_22202.1402.2.0_neutral_ _8wekyb3d8bbwe.msixbundle herunterladen 
echo --------------------------------------------------
echo --------------------------------------------------
echo Eigener Text 
echo Und lege diese heruntergeladene Dateien in selben Verzeichnis wie das Script 
echo --------------------------------------------------
pause

cls
dir /b Microsoft.NET.Native.Framework*.appx >>appstore.txt
dir /b Microsoft.NET.Native.Runtime*.appx >>appstore.txt
dir /b Microsoft.UI.Xaml*.appx >>appstore.txt
dir /b Microsoft.VCLibs*.appx >>appstore.txt
dir /b Microsoft.WindowsStore*.msixbundle >>appstore.txt

for /f %%i in ('findstr /i . appstore.txt 2^>nul') do dism /Online /add-provisionedappxpackage /packagepath:%%i /SkipLicense

del appstore.txt

pause
exit