@echo off
set T=c:\TEMP
set W10=%T%\W10
set DEVICEPATH=

IF %1.==. GOTO USAGE

echo ====================
echo Extract ISO file ...
echo ====================
echo.

rem get fullpath of isofile ...
set ISOFILE=%~f1

if NOT EXIST %ISOFILE% (
  echo ERROR: file %ISOFILE% not found!
  exit /b
)

rem =====
rem MAIN
rem =====

echo preparing %T% ...
mkdir %T% 1>nul 2>nul
rd /S /Q %W10% 1>nul 2>nul
mkdir %W10% 1>nul 2>nul

echo mounting disk image (iso) with powershell ...
for /f %%i in ('"powershell $diskImage=Mount-DiskImage -ImagePath %ISOFILE% -NoDriveLetter; write-host $diskImage.DevicePath"') do @set DEVICEPATH=%%i

echo copying files from image to targetpath %W10% ...
robocopy %DEVICEPATH% %W10% /MIR /256 /NFL /NDL /R:1

echo unmounting disk image (iso) ...
powershell Dismount-Diskimage -ImagePath %ISOFILE%

echo ======
echo READY.
echo ======
echo.

GOTO END

:USAGE
echo "usage: %0 <ISOFILE>"

:END

