Install UWP
Install UWP
Install UWP
md scratchdir
ECHO %DATE% %TIME%[Log TRACE] SET ImgPath=/online >>%LogPath% 2>&1
SET ImgPath=/online
if /i "%SystemDrive%" neq "%~d0" (
ECHO !DATE! !TIME![Log TRACE] Running in the WinPE or Offline, SET
ImgPath=/image:%~d0\ >>%LogPath% 2>&1
SET ImgPath=/image:%~d0\
ECHO !DATE! !TIME![Log TRACE] goto :InstallUWP >>%LogPath% 2>&1
goto :InstallUWP
)
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::
:::: DO Not Trim Trailing space............
::::
:::: Each Set Value in the end exist the Space for dism split paramter
:::: set APPXPackagePath_X86=!APPXPackagePath_X86!/dependencypackagepath:"%%d"
::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:InstallUWP
IF /i "%PROCESSOR_ARCHITECTURE%" equ "AMD64" (
call :GetParameter
REM ECHO %DATE% %TIME%[Log TRACE] dism %ImgPath% /english /add-
provisionedappxpackage /packagepath:"!packagepath!" /licensepath:"!licensepath!" !
DependencyPackage_X64!/CustomDataPath:"%CustomDATA%" /region:all
/scratchdir:scratchdir>>%LogPath% 2>&1
REM dism %ImgPath% /english /add-provisionedappxpackage /packagepath:"!
packagepath!" /licensepath:"!licensepath!"
!DependencyPackage_X64!/CustomDataPath:"%CustomDATA%" /region:all
/scratchdir:scratchdir>>%LogPath% 2>&1
ECHO %DATE% %TIME%[Log TRACE] dism %ImgPath% /english /add-
provisionedappxpackage /packagepath:"!packagepath!" /licensepath:"!licensepath!" !
DependencyPackage_X64!/region:all /scratchdir:scratchdir>>%LogPath% 2>&1
dism %ImgPath% /english /add-provisionedappxpackage /packagepath:"!
packagepath!" /licensepath:"!licensepath!" !DependencyPackage_X64!/region:all
/scratchdir:scratchdir>>%LogPath% 2>&1
) else (
call :GetParameter
REM ECHO %DATE% %TIME%[Log TRACE] dism %ImgPath% /english /add-
provisionedappxpackage /packagepath:"!packagepath!" /licensepath:"!licensepath!" !
DependencyPackage_X86!/CustomDataPath:"%CustomDATA%" /region:all
/scratchdir:scratchdir>>%LogPath% 2>&1
REM dism %ImgPath% /english /add-provisionedappxpackage /packagepath:"!
packagepath!" /licensepath:"!licensepath!"
!DependencyPackage_X86!/CustomDataPath:"%CustomDATA%" /region:all
/scratchdir:scratchdir>>%LogPath% 2>&1
ECHO %DATE% %TIME%[Log TRACE] dism %ImgPath% /english /add-
provisionedappxpackage /packagepath:"!packagepath!" /licensepath:"!licensepath!" !
DependencyPackage_X86!/region:all /scratchdir:scratchdir>>%LogPath% 2>&1
dism %ImgPath% /english /add-provisionedappxpackage /packagepath:"!
packagepath!" /licensepath:"!licensepath!" !DependencyPackage_X86!/region:all
/scratchdir:scratchdir>>%LogPath% 2>&1
)
SET DISMErrCode=%errorlevel%
ECHO %DATE% %TIME%[Log TRACE] got return code [%DISMErrCode%] >>%LogPath%
if %DISMErrCode% neq 0 (
ECHO %DATE% %TIME%[Log TRACE] Return code is [%DISMErrCode%], pop up error
message to remind user. >>%LogPath%
call :ErrorMsg
) else (
ECHO %DATE% %TIME%[Log TRACE] Return code is [%DISMErrCode%], leave. >>
%LogPath%
)
:END
if exist scratchdir rd /s /q scratchdir
popd
SETLOCAL DISABLEDELAYEDEXPANSION
ECHO %DATE% %TIME%[Log LEAVE] ============ %~dpnx0 ============ >> %LogPath%
ECHO.>>%LogPath%
exit /b 0
:GetParameter
:GetPackagePath_Start
REM Prepare PackagePath
:Method1
ECHO %DATE% %TIME%[Log TRACE] dir /s /b *.appxbundle >> %LogPath%
dir /s /b *.appxbundle >> %LogPath% 2>&1
(for /f "delims=" %%d in ('dir /s /b *.appxbundle') do (
set packagepath=%%d
))>NUL 2>&1
:Method2
ECHO %DATE% %TIME%[Log TRACE] dir /s /b *.msix >> %LogPath%
dir /s /b *.msix >> %LogPath% 2>&1
(for /f "delims=" %%d in ('dir /s /b *.msix') do (
set packagepath=%%d
))>NUL 2>&1
:Method3
ECHO %DATE% %TIME%[Log TRACE] dir /s /b *.msixbundle >> %LogPath%
dir /s /b *.msixbundle >> %LogPath% 2>&1
(for /f "delims=" %%d in ('dir /s /b *.msixbundle') do (
set packagepath=%%d
))>NUL 2>&1
:Method4
ECHO %DATE% %TIME%[Log TRACE] dir /s /b *.appx>> %LogPath% 2>&1
dir /s /b *.appx>%~d0\OEM\Appx_list.txt 2>&1
if %errorlevel% neq 0 (
ECHO !DATE! !TIME![Log TRACE] *.appx not found, goto :GetPackagePath_END >>
%LogPath%
goto :GetPackagePath_END
)
type %~d0\OEM\Appx_list.txt >> %LogPath%
ECHO %DATE% %TIME%[Log TRACE] Getting Dependency Appx list>>%LogPath%
dir /s /b Microsoft*.appx>%~d0\OEM\DependencyAppx_list.txt 2>&1
type %~d0\OEM\DependencyAppx_list.txt >>%LogPath%
for /f "delims=" %%f in (%~d0\OEM\Appx_list.txt) do (
ECHO
------------------------------------------------------------------------------ >>
%LogPath%
ECHO !DATE! !TIME![Log TRACE] Checking [%%~nf] if main Package... >>%LogPath
%
ECHO !DATE! !TIME![Log TRACE] find /i "%%~nf" %~d0\OEM\
DependencyAppx_list.txt>>%LogPath% 2>&1
find /i "%%~nf" %~d0\OEM\DependencyAppx_list.txt>>%LogPath% 2>&1
if !errorlevel! neq 0 (
ECHO !DATE! !TIME![Log TRACE] [%%~nxf] did not exist in the %~d0\OEM\
DependencyAppx_list.txt, set as PackagePath>>%LogPath%
set PackagePath=%%f
) else (
ECHO !DATE! !TIME![Log TRACE] [%%~nxf] exist in the %~d0\OEM\
DependencyAppx_list.txt, not the main package. >>%LogPath%
)
)
:GetPackagePath_END
ECHO %DATE% %TIME%[Log TRACE] PackagePath is [%packagepath%] >> %LogPath%
ECHO.>>%LogPath%
:ErrorMsg
if exist %~d0\OEM\NAPP\D2D.tag (
ECHO %DATE% %TIME%[Log TRACE] %~d0\OEM\NAPP\D2D.tag found, exit /b 0 >>
%LogPath%
exit /b 0
)
ECHO MsgBox "ERROR! Driver UWP Install process failed with ERROR code %DISMErrCode
%",16,"Driver UWP Installation Detection" >ErrorMsg.vbs
CScript /nologo ErrorMsg.vbs
CScript /nologo ErrorMsg.vbs
CScript /nologo ErrorMsg.vbs
exit /b 0
:CheckingVCLib
:GetVCLibs_Start
SET CheckingVCLib_Now=%TargetVCLib%*_%1*.appx
ECHO.
ECHO -----------------------------------------------------------------
ECHO %DATE% %TIME%[Log TRACE] Current working directory is [!CD!]
ECHO %DATE% %TIME%[Log TRACE] dir /b %CheckingVCLib_Now%
dir /b %CheckingVCLib_Now%
if %errorlevel% neq 0 ECHO %DATE% %TIME%[Log TRACE] dir /b %CheckingVCLib_Now% not
exist, exit /b 0 && exit /b 0