@echo off
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
cd /d "%~dp0"
cls
echo Checking Minisforum Log folder path...
if not exist C:\Minisforum.sav\DrverInstall md C:\Minisforum.sav\DrverInstall & attrib +H C:\Minisforum.sav

echo Start Installing Realtek Audio APP...
@set L=C:\Minisforum.sav\DrverInstall\RealtekAudioAPP.log
@set IP=[===========Install Pass===========]
@set IPR=[===========Install Pass, Restart is need===========]
@set IF=[===========Install Fail===========]
@set APPX=71c2f76e085a4c4685118bb4bbb0ddc1.appxbundle
@set LC=71c2f76e085a4c4685118bb4bbb0ddc1_License1.xml
@set VC=Microsoft.VCLibs.140.00_14.0.30704.0_x64__8wekyb3d8bbwe.appx

@echo [%time%]Install Realtek Audio App >> %L%
DISM /Online /Add-ProvisionedAppxPackage /PackagePath:"%~dp0Apps\%APPX%" /licensepath:"%~dp0Apps\%LC%" /DependencyPackagePath:"%~dp0Apps\%VC%" /Region="All"
@set value=%errorlevel%
@if %errorlevel%==0 (echo [%time%]%IP% >> %L% & set value=0)
@if %errorlevel%==259 (echo [%time%]%errorlevel% >> %L% & set value=0)
@if %errorlevel%==3010 (echo [%time%]%IPR% >> %L% & set value=0)
@if not %value%==0 (echo [%time%]%IF% >> %L% & exit /b 1)

:resultpass
@echo [%time%]=========Realtek Audio App Install complete========= >> %L%
ECHO ERRRORLEVEL=%ERRORLEVEL% >> %L%
EXIT /B 0

:ERR
echo [%time%]%IF% >> %L%
ECHO ERRRORLEVEL=%ERRORLEVEL% >> %L%
EXIT /B 1