w10install/PrepareStick.cmd

86 lines
1.8 KiB
Batchfile
Raw Normal View History

2020-12-25 20:08:46 +01:00
@echo off
2021-01-10 15:49:37 +01:00
set SOURCES=c:\TEMP\W10\sources
2020-12-25 20:08:46 +01:00
2021-01-10 15:49:37 +01:00
rem ===================
rem COMMANDLINE CHECKS
rem ===================
2020-12-25 20:08:46 +01:00
2021-01-10 15:49:37 +01:00
IF %1.==. GOTO USAGE
set USBDRIVE=%1
2021-01-10 00:22:42 +01:00
2021-01-10 15:49:37 +01:00
if NOT EXIST %USBDRIVE% (
echo ERROR: file %USBDRIVE% does not exist!
exit /b
)
if /I %USBDRIVE% == C: (
echo ERROR: cannot use drive %USBDRIVE% !
exit /b
)
rem =====
rem MAIN
rem =====
echo using drive %USBDRIVE% ...
if NOT EXIST %USBDRIVE% (
echo ERROR: drive %USBDRIVE% not found!
2021-01-10 00:22:42 +01:00
exit /b
)
2021-01-12 19:22:13 +01:00
set answer=
2021-01-10 00:22:42 +01:00
:ask
set /p answer="BIOS or UEFI setup (B/U)? "
if /i "%answer:~,1%" EQU "B" (
2021-01-12 19:22:13 +01:00
echo selected: BIOS
2021-01-10 15:49:37 +01:00
copy /Y autounattend_BIOS.xml %USBDRIVE%\autounattend.xml
GOTO CONT
2021-01-10 00:22:42 +01:00
)
if /i "%answer:~,1%" EQU "U" (
2021-01-12 19:22:13 +01:00
echo selected: UEFI
2021-01-10 15:49:37 +01:00
copy /Y autounattend_UEFI.xml %USBDRIVE%\autounattend.xml
GOTO CONT
2021-01-10 00:22:42 +01:00
)
echo Please type B for BIOS or U for UEFI setup.
goto ask
2021-01-10 15:49:37 +01:00
:CONT
2021-01-10 00:22:42 +01:00
2020-12-25 20:08:46 +01:00
if EXIST %SOURCES%\install_FINAL.esd (
2021-01-10 15:49:37 +01:00
echo copying install.esd to drive %USBDRIVE% ...
2021-01-10 23:14:52 +01:00
robocopy %SOURCES% %USBDRIVE%\sources install_FINAL.esd /J /NJH
2021-01-10 15:49:37 +01:00
del /F %USBDRIVE%\sources\install.esd
move /Y %USBDRIVE%\sources\install_FINAL.esd %USBDRIVE%\sources\install.esd
2021-01-10 00:22:42 +01:00
move /Y %SOURCES%\install_FINAL.esd %SOURCES%\install_FINAL_copy.esd
2020-12-25 20:08:46 +01:00
)
2021-01-12 17:01:34 +01:00
echo.
if EXIST tools (
echo copying folder tools to drive %USBDRIVE% ...
2021-01-12 19:22:13 +01:00
robocopy tools %USBDRIVE%\tools /COPY:DT /FFT /XO /256 /NJH /NJS /NDL /XF .gitignore
2021-01-12 17:01:34 +01:00
)
for %%P in (software scripts) do (
2021-01-10 15:49:37 +01:00
if EXIST %%P (
2021-01-10 23:14:52 +01:00
echo.
2021-01-12 17:01:34 +01:00
echo copying folder %%P to drive %USBDRIVE%\tools ...
robocopy %%P %USBDRIVE%\tools\%%P /COPY:DT /FFT /XO /MIR /256 /NJH /NJS /NDL /XF .gitignore
2021-01-10 15:49:37 +01:00
)
)
2021-01-10 23:14:52 +01:00
echo.
2021-01-10 15:49:37 +01:00
echo copying custom setup script to %USBDRIVE% ...
copy /Y CustomSetup.cmd %USBDRIVE%\
rem =====
rem END
rem =====
GOTO END
:USAGE
echo "usage: %0 <USBDRIVE>"
:END