somehow dism can't unmount the mounted folder completely, remove it before mounting

This commit is contained in:
slore 2018-06-26 14:45:29 +08:00
parent 0f5951dcc0
commit e7864b1fdc
2 changed files with 16 additions and 1 deletions

View File

@ -2,6 +2,20 @@ if "x%3"=="x" goto :EOF
if not "x%~4"=="x" set %~4=
call WB_LOG "[%WB_PROJECT%] --- MOUNT [%~1:%2] -%%gt:%% [%~3]"
rem remove uncompleted mounted folder first.
set chk_file=
if exist "%~3" (
for /f "delims=" %%i in ('dir /b "%~3"') do (
set "chk_file=%%i"
)
)
if "x%chk_file%"=="x" (
rd /q "%~3"
)
set chk_file=
if not exist "%~3" mkdir "%~3"
call DismX /mount-wim /wimfile:"%~1" /index:%2 /mountdir:"%~3"

View File

@ -20,10 +20,11 @@ if "x%1"=="x0" (
set UNMNT_OPT=/commit
)
if exist X:\ SUBST X: /D
if exist "%_WB_MNT_DIR%\Windows" (
call WIM_UnMounter.bat "%_WB_MNT_DIR%" %UNMNT_OPT% base_wim_mounted
)
if exist X:\ SUBST X: /D
echo Cleanup finished.