w10install/05_PrepareStick.cmd
Michael H.G. Schmidt 7e17c0bb06 .
2022-10-04 14:23:01 +02:00

73 lines
1.4 KiB
Batchfile

@echo off
IF %1.==. GOTO USAGE
IF %2.==. GOTO USAGE
echo.
echo ====================
echo Create USB Stick ...
echo ====================
rem get fullpath of isofile ...
set USBDRIVE=%1
set ISOFILE=%~f2
if NOT EXIST %ISOFILE% (
echo ERROR: file %ISOFILE% not found!
exit /b
)
if /I %USBDRIVE% == C: (
echo ERROR: cannot use drive %USBDRIVE% !
exit /b
)
if NOT EXIST %USBDRIVE% (
echo ERROR: drive %USBDRIVE% not found!
exit /b
)
rem =====
rem MAIN
rem =====
echo using drive %USBDRIVE% ...
echo using image %ISOFILE% ...
echo mounting disk image (iso) with powershell ...
powershell Mount-DiskImage -ImagePath %ISOFILE%
set answer=
:askyes
set /p answer="copy windows image (WIM) files (Y/N)? "
if /i "%answer:~,1%" EQU "Y" (
echo copying files from image to targetpath %USBDRIVE% ...
robocopy \\.\CDROM0 %USBDRIVE% /MIR /256 /NFL /NDL /R:10
GOTO CONT
)
if /i "%answer:~,1%" EQU "N" (
echo copying files from image to targetpath %USBDRIVE% ...
robocopy \\.\CDROM0 %USBDRIVE% /MIR /256 /NFL /NDL /R:10 /XF *.wim /XF *.esd
goto CONT
)
echo Please type Y or N.
goto askyes
:CONT
echo unmounting disk image (iso) ...
powershell Dismount-Diskimage -ImagePath %ISOFILE%
echo READY.
echo.
rem =====
rem END
rem =====
GOTO END
:USAGE
echo "usage: %0 <USBDRIVE> <ISOFILE>"
:END