:: REM CMD File Location = C:\SWWORK\A2AppM\%MODNAME%.CMD



:: MODNAME variable is ALREADY set by module process!
SET APPXSHORTNAME=RealtekSemiconductorCorp.RealtekAudioControl
SET APPXFULLNAME=RealtekSemiconductorCorp.RealtekAudioControl_1.28.255.0_neutral_~_dt26b99r8h8gj


ECHO START Module AppX Install - AppName: %APPXSHORTNAME% - ModuleName: %MODNAME% >>C:\SWWORK\Modules.log


:: Add dependencies
DISM /Online /Add-ProvisionedAppxPackage /PackagePath:C:\SWWORK\%MODNAME%\f20052f857d8447eb28001d22d171837.appxbundle /DependencyPackagePath:C:\SWWORK\%MODNAME%\Microsoft.VCLibs.140.00_14.0.30035.0_x64__8wekyb3d8bbwe.appx /DependencyPackagePath:C:\SWWORK\%MODNAME%\Microsoft.VCLibs.140.00_14.0.30035.0_x86__8wekyb3d8bbwe.appx /LicensePath:C:\SWWORK\%MODNAME%\f20052f857d8447eb28001d22d171837_License1.xml /region="all"

:: REM Retrieve full PFN for the installed app (Which contains version and architecture)
ECHO Retrieving PFN for %APPXSHORTNAME% >>c:\SWWORK\modules.log
DISM /online /Get-ProvisionedAppxPackages /english > %TEMP%\appx-haystack.txt
find /i "%APPXSHORTNAME%" %TEMP%\appx-haystack.txt > %TEMP%\appx-needle.txt
if errorlevel 1 (
                ECHO No matching appx for %APPXSHORTNAME% Found >>C:\SWWORK\modules.log
                exit /b 0
			)

FOR /F "tokens=1* delims==: " %%A IN ('TYPE "%TEMP%\appx-needle.txt"') DO IF /i %%A==PACKAGENAME SET APPXPACKAGEFULLNAME=%%B
ECHO APPX FULL NAME FOR "%APPXSHORTNAME%" IS "%APPXPACKAGEFULLNAME%"  >>C:\SWWORK\modules.log
del %TEMP%\appx-haystack.txt
del %TEMP%\appx-needle.txt

ECHO END Module AppX Install - AppName: %APPXSHORTNAME% - ModuleName: %MODNAME% >>C:\SWWORK\Modules.log

:END 
::SET MODNAME=
SET APPXFULLNAME=
SET APPXSHORTNAME=
SET APPXPACKAGEFULLNAME=
exit /b 0
