2020-12-25 20:08:46 +01:00
|
|
|
@echo off
|
2023-02-06 17:03:13 +01:00
|
|
|
set T=c:\temp
|
2023-01-02 17:15:02 +01:00
|
|
|
set W10=c:\TEMP\W10
|
|
|
|
set SOURCES=%W10%\sources
|
2023-02-07 16:39:44 +01:00
|
|
|
set BOOTFILE=boot.wim
|
|
|
|
set IMAGEFILE=install.wim
|
2022-06-21 22:55:51 +02:00
|
|
|
set SCRIPT_SETTINGS=scripts\settings.cmd
|
2022-06-19 16:40:47 +02:00
|
|
|
set COMPANY_SETTINGS=company\settings.cmd
|
2023-01-22 12:56:24 +01:00
|
|
|
set LANG=en-US
|
2023-01-22 17:58:47 +01:00
|
|
|
set MYUSER=
|
|
|
|
set MYNAME=
|
|
|
|
set MYPASS=
|
2020-12-25 20:08:46 +01:00
|
|
|
|
2021-03-18 00:08:40 +01:00
|
|
|
IF %1.==. GOTO USAGE
|
|
|
|
|
2022-06-19 16:40:47 +02:00
|
|
|
rem ===================
|
|
|
|
rem CONFIGFILE CHECK
|
|
|
|
rem ===================
|
|
|
|
|
2022-12-13 16:29:35 +01:00
|
|
|
echo searching for SCRIPT settings ...
|
|
|
|
if NOT EXIST %SCRIPT_SETTINGS% (
|
2023-01-02 14:33:56 +01:00
|
|
|
echo INFO: config file %SCRIPT_SETTINGS% NOT FOUND
|
2022-12-13 16:29:35 +01:00
|
|
|
) else (
|
|
|
|
echo OK. Loading SCRIPT settings ...
|
|
|
|
call %SCRIPT_SETTINGS%
|
2022-06-19 16:40:47 +02:00
|
|
|
)
|
|
|
|
|
2022-12-13 16:29:35 +01:00
|
|
|
echo searching for COMPANY settings ...
|
2022-06-19 16:40:47 +02:00
|
|
|
if NOT EXIST %COMPANY_SETTINGS% (
|
2022-12-13 16:29:35 +01:00
|
|
|
echo INFO: config file %COMPANY_SETTINGS% NOT FOUND
|
2022-06-19 16:40:47 +02:00
|
|
|
) else (
|
|
|
|
echo OK. Loading COMPANY settings ...
|
|
|
|
call %COMPANY_SETTINGS%
|
|
|
|
)
|
|
|
|
|
2021-03-17 00:22:50 +01:00
|
|
|
echo.
|
2023-01-02 17:15:02 +01:00
|
|
|
echo =================================
|
|
|
|
echo Copying all data to USB Stick ...
|
|
|
|
echo =================================
|
|
|
|
echo.
|
2020-12-25 20:08:46 +01:00
|
|
|
|
2021-01-10 15:49:37 +01:00
|
|
|
set USBDRIVE=%1
|
2021-01-10 00:22:42 +01:00
|
|
|
|
2021-01-10 15:49:37 +01:00
|
|
|
if /I %USBDRIVE% == C: (
|
|
|
|
echo ERROR: cannot use drive %USBDRIVE% !
|
|
|
|
exit /b
|
|
|
|
)
|
|
|
|
|
|
|
|
if NOT EXIST %USBDRIVE% (
|
|
|
|
echo ERROR: drive %USBDRIVE% not found!
|
2021-01-10 00:22:42 +01:00
|
|
|
exit /b
|
|
|
|
)
|
|
|
|
|
2021-03-14 19:39:32 +01:00
|
|
|
echo using drive %USBDRIVE% ...
|
|
|
|
|
2021-01-29 11:57:12 +01:00
|
|
|
rem =====
|
|
|
|
rem MAIN
|
|
|
|
rem =====
|
|
|
|
|
2023-01-11 15:12:49 +01:00
|
|
|
echo.
|
|
|
|
echo IMPORTANT:
|
|
|
|
echo How is your target media formatted?
|
|
|
|
echo - use "exfat" for BIOS based installations only!
|
|
|
|
echo - use "fat32" for UEFI based installations only!
|
|
|
|
echo REASON: UEFI cannot read "exfat" filesystems and Windows setup will throw error code: 0x80042565
|
|
|
|
echo.
|
|
|
|
|
2023-01-11 15:26:22 +01:00
|
|
|
set answer=B
|
2021-01-10 00:22:42 +01:00
|
|
|
:ask
|
2023-01-11 15:26:22 +01:00
|
|
|
set /p answer="BIOS(default) or UEFI setup (B/U)? "
|
2021-01-10 00:22:42 +01:00
|
|
|
if /i "%answer:~,1%" EQU "B" (
|
2021-01-12 19:22:13 +01:00
|
|
|
echo selected: BIOS
|
2022-12-29 10:49:17 +01:00
|
|
|
copy /Y image\autounattend_BIOS_template.xml %USBDRIVE%\autounattend.xml
|
2021-03-14 19:39:32 +01:00
|
|
|
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
|
2022-12-29 10:49:17 +01:00
|
|
|
copy /Y image\autounattend_UEFI_template.xml %USBDRIVE%\autounattend.xml
|
2021-03-14 19:39:32 +01:00
|
|
|
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
|
|
|
|
2021-03-28 17:51:56 +02:00
|
|
|
rem ask for user ...
|
2023-01-22 14:29:05 +01:00
|
|
|
if "@%localadmin%" NEQ "@" (
|
|
|
|
set MYUSER=%localadmin%
|
2022-06-19 16:40:47 +02:00
|
|
|
) else (
|
|
|
|
echo.
|
|
|
|
set /p MYUSER="Username (%MYUSER%)? "
|
|
|
|
)
|
2021-03-28 17:51:56 +02:00
|
|
|
|
|
|
|
rem ask for real name ...
|
2023-01-22 14:29:05 +01:00
|
|
|
if "@%localadmin_name%" NEQ "@" (
|
|
|
|
set MYNAME=%localadmin_name%
|
2022-06-19 16:40:47 +02:00
|
|
|
) else (
|
|
|
|
echo.
|
|
|
|
set /p MYNAME="Display Name (%MYNAME%)? "
|
|
|
|
)
|
2021-03-28 17:51:56 +02:00
|
|
|
|
|
|
|
rem ask for a password ...
|
2023-01-22 14:29:05 +01:00
|
|
|
if "@%localadmin_password%" NEQ "@" (
|
|
|
|
set MYPASS=%localadmin_password%
|
2022-06-19 16:40:47 +02:00
|
|
|
) else (
|
|
|
|
echo.
|
|
|
|
set /p MYPASS="Password (not set)? "
|
|
|
|
)
|
2021-03-28 17:51:56 +02:00
|
|
|
|
|
|
|
echo.
|
2021-03-28 17:55:17 +02:00
|
|
|
tools\searchreplace %USBDRIVE%\autounattend.xml ___MYUSER___ "%MYUSER%"
|
|
|
|
tools\searchreplace %USBDRIVE%\autounattend.xml ___MYNAME___ "%MYNAME%"
|
|
|
|
tools\searchreplace %USBDRIVE%\autounattend.xml ___MYPASS___ "%MYPASS%"
|
2021-03-31 00:22:47 +02:00
|
|
|
tools\searchreplace %USBDRIVE%\autounattend.xml ___MYLANG___ "%LANG%"
|
2021-03-28 17:51:56 +02:00
|
|
|
|
2023-02-07 16:39:44 +01:00
|
|
|
if NOT EXIST %SOURCES%\%BOOTFILE% (
|
|
|
|
echo DOH! no %BOOTFILE% in [ %SOURCES% ] found
|
2022-06-08 19:58:48 +02:00
|
|
|
exit /b
|
|
|
|
)
|
2021-03-17 13:05:50 +01:00
|
|
|
|
2023-02-07 16:39:44 +01:00
|
|
|
if NOT EXIST %SOURCES%\%IMAGEFILE% (
|
|
|
|
if NOT EXIST %T%\%IMAGEFILE% (
|
2023-02-06 17:03:13 +01:00
|
|
|
echo DOH! no %IMAGE% in [ %SOURCES% ] or in [ %T% ] found
|
|
|
|
exit /b
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2023-02-07 16:39:44 +01:00
|
|
|
if EXIST %T%\%IMAGEFILE% (
|
|
|
|
echo moving [ %T%\%IMAGEFILE% ] to %SOURCES% ...
|
|
|
|
move /Y %T%\%IMAGEFILE% %SOURCES%
|
2020-12-25 20:08:46 +01:00
|
|
|
)
|
|
|
|
|
2023-01-02 17:15:02 +01:00
|
|
|
echo copying all files in [ %W10% ] to drive %USBDRIVE% ...
|
2023-02-08 16:31:52 +01:00
|
|
|
robocopy %W10%\ %USBDRIVE% /MIR /256 /NDL /R:0 /J /XX || exit /b
|
2023-01-02 17:15:02 +01:00
|
|
|
|
2021-03-14 19:39:32 +01:00
|
|
|
:CONT
|
2021-01-12 17:01:34 +01:00
|
|
|
if EXIST tools (
|
2021-03-31 14:49:02 +02:00
|
|
|
echo.
|
2021-03-17 00:22:50 +01:00
|
|
|
echo copying folder [ tools ] to drive %USBDRIVE% ...
|
2023-02-08 16:31:52 +01:00
|
|
|
robocopy tools %USBDRIVE%\tools /COPY:DT /FFT /XO /256 /NJH /NJS /NDL ^
|
|
|
|
/R:0 /XF .gitignore || exit /b
|
2021-01-12 17:01:34 +01:00
|
|
|
)
|
|
|
|
|
2021-03-28 18:19:09 +02:00
|
|
|
if EXIST software (
|
|
|
|
echo.
|
|
|
|
echo copying folder [ software ] to %USBDRIVE%\tools ...
|
2023-02-08 16:31:52 +01:00
|
|
|
robocopy software %USBDRIVE%\tools\software /COPY:DT /FFT /XO /MIR /256 /NJH /NJS /NDL /R:0 ^
|
|
|
|
/XF *.iso /XF *.txt /XF *.cmd /XF *.csv /XF .gitignore /XD .git || exit /b
|
2021-03-28 18:19:09 +02:00
|
|
|
)
|
|
|
|
|
2023-01-01 18:04:13 +01:00
|
|
|
for %%P in (drivers scripts source optional personal company apps) do (
|
2021-01-10 15:49:37 +01:00
|
|
|
if EXIST %%P (
|
2021-01-10 23:14:52 +01:00
|
|
|
echo.
|
2021-03-17 00:22:50 +01:00
|
|
|
echo copying folder [ %%P ] to %USBDRIVE%\tools ...
|
2023-02-08 16:31:52 +01:00
|
|
|
robocopy %%P %USBDRIVE%\tools\%%P /COPY:DT /FFT /XO /MIR /256 /NJH /NJS /NDL ^
|
|
|
|
/R:0 /XF .gitignore /XD .git || exit /b
|
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% ...
|
2022-12-29 10:49:17 +01:00
|
|
|
copy /Y image\CustomSetup.cmd %USBDRIVE%\
|
2021-03-17 00:22:50 +01:00
|
|
|
|
2022-06-18 10:41:57 +02:00
|
|
|
echo.
|
|
|
|
echo putting tools-copy script to %USBDRIVE% ...
|
2022-12-29 10:49:17 +01:00
|
|
|
copy /Y image\CopyTools.cmd %USBDRIVE%\
|
2022-06-18 10:41:57 +02:00
|
|
|
|
2021-03-14 19:39:32 +01:00
|
|
|
echo.
|
2023-01-02 17:15:02 +01:00
|
|
|
echo ======
|
|
|
|
echo READY.
|
|
|
|
echo ======
|
2021-01-10 15:49:37 +01:00
|
|
|
|
|
|
|
GOTO END
|
|
|
|
|
|
|
|
:USAGE
|
|
|
|
echo "usage: %0 <USBDRIVE>"
|
2021-02-24 22:26:55 +01:00
|
|
|
echo.
|
2021-01-10 15:49:37 +01:00
|
|
|
|
|
|
|
:END
|
|
|
|
|