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
|
2023-02-23 10:36:59 +01:00
|
|
|
set SCRIPT_SETTINGS=scripts\settings.cmd
|
|
|
|
set COMPANY_SETTINGS=company\settings.cmd
|
2023-02-08 22:48:50 +01:00
|
|
|
set FOURGB=4294967296
|
2020-12-25 20:08:46 +01:00
|
|
|
|
2021-03-18 00:08:40 +01:00
|
|
|
IF %1.==. GOTO USAGE
|
|
|
|
|
2021-03-17 00:22:50 +01:00
|
|
|
echo.
|
2023-01-02 17:15:02 +01:00
|
|
|
echo =================================
|
2023-02-20 10:35:26 +01:00
|
|
|
echo Copying all data to Media ...
|
2023-01-02 17:15:02 +01:00
|
|
|
echo =================================
|
|
|
|
echo.
|
2020-12-25 20:08:46 +01:00
|
|
|
|
2023-02-20 10:35:26 +01:00
|
|
|
set DRIVE=%1
|
2021-01-10 00:22:42 +01:00
|
|
|
|
2023-02-20 10:35:26 +01:00
|
|
|
if /I %DRIVE% == C: (
|
|
|
|
echo ERROR: cannot use drive %DRIVE% !
|
2021-01-10 15:49:37 +01:00
|
|
|
exit /b
|
|
|
|
)
|
|
|
|
|
2023-02-20 10:35:26 +01:00
|
|
|
if NOT EXIST %DRIVE% (
|
|
|
|
echo ERROR: drive %DRIVE% not found!
|
2021-01-10 00:22:42 +01:00
|
|
|
exit /b
|
|
|
|
)
|
|
|
|
|
2023-02-20 10:35:26 +01:00
|
|
|
echo using drive [ %DRIVE% ] ...
|
2023-02-08 22:48:50 +01:00
|
|
|
echo.
|
|
|
|
|
|
|
|
rem get drive type (is it fat32 ?) ...
|
2023-02-20 10:35:26 +01:00
|
|
|
for /f "tokens=5" %%A in ('@fsutil fsinfo volumeinfo %DRIVE%^|findstr /B "File System Name : "') do (@set DRIVETYPE=%%A)
|
2023-02-20 15:11:28 +01:00
|
|
|
echo DRIVETPYE = [ %DRIVETYPE% ]
|
2021-03-14 19:39:32 +01:00
|
|
|
|
2023-02-08 22:48:50 +01:00
|
|
|
rem check SOURCE for files LARGER 4 GB in case FAT32 was chosen ...
|
|
|
|
if /i "%DRIVETYPE%" EQU "fat32" (
|
2023-02-14 01:03:07 +01:00
|
|
|
for /f "tokens=*" %%F in ('"dir /S /B /A-D %W10%"') do if %%~zF GTR %FOURGB% (
|
|
|
|
echo ERROR: The file [ %%F : %%~zF bytes ] is greater than 4GB in size - cannot copy this to a FAT32 filesystem!
|
2023-02-08 22:48:50 +01:00
|
|
|
exit /b
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
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% (
|
2023-02-20 10:35:26 +01:00
|
|
|
echo DOH! no %IMAGE% in [ %SOURCES% ] found
|
|
|
|
exit /b
|
2023-02-06 17:03:13 +01:00
|
|
|
|
2020-12-25 20:08:46 +01:00
|
|
|
)
|
|
|
|
|
2023-02-23 10:36:59 +01:00
|
|
|
rem =====
|
|
|
|
rem MAIN
|
|
|
|
rem =====
|
|
|
|
|
2023-02-20 10:35:26 +01:00
|
|
|
echo copying all files in [ %W10% ] to drive %DRIVE% ...
|
|
|
|
robocopy %W10%\ %DRIVE% /MIR /256 /NDL /R:1 /J /XX
|
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.
|
2023-02-20 10:35:26 +01:00
|
|
|
echo copying folder [ tools ] to drive %DRIVE% ...
|
|
|
|
robocopy tools %DRIVE%\tools /COPY:DT /FFT /XO /256 /NJH /NJS /NDL /R:1 /XF .gitignore
|
2021-01-12 17:01:34 +01:00
|
|
|
)
|
|
|
|
|
2021-03-28 18:19:09 +02:00
|
|
|
if EXIST software (
|
|
|
|
echo.
|
2023-02-20 10:35:26 +01:00
|
|
|
echo copying folder [ software ] to %DRIVE%\tools ...
|
|
|
|
robocopy software %DRIVE%\tools\software /COPY:DT /FFT /XO /MIR /256 /NJH /NJS /NDL /R:1 ^
|
2023-02-08 22:48:50 +01:00
|
|
|
/XF *.iso /XF *.txt /XF *.cmd /XF *.csv /XF .gitignore /XD .git
|
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.
|
2023-02-20 10:35:26 +01:00
|
|
|
echo copying folder [ %%P ] to %DRIVE%\tools ...
|
|
|
|
robocopy %%P %DRIVE%\tools\%%P /COPY:DT /FFT /XO /MIR /256 /NJH /NJS /NDL ^
|
2023-02-08 22:48:50 +01:00
|
|
|
/R:1 /XF .gitignore /XD .git
|
2021-01-10 15:49:37 +01:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2021-01-10 23:14:52 +01:00
|
|
|
echo.
|
2023-02-20 10:35:26 +01:00
|
|
|
echo copying autoconfig starter script to %DRIVE% ...
|
|
|
|
copy /Y image\StartAutoConfig.cmd %DRIVE%\
|
2021-03-17 00:22:50 +01:00
|
|
|
|
2022-06-18 10:41:57 +02:00
|
|
|
echo.
|
2023-02-20 10:35:26 +01:00
|
|
|
echo putting copytools script to %DRIVE% ...
|
|
|
|
copy /Y image\CopyTools.cmd %DRIVE%\
|
2022-06-18 10:41:57 +02:00
|
|
|
|
2023-03-10 15:29:22 +01:00
|
|
|
rem remove hidden attribute from tools folder ...
|
|
|
|
attrib -H %DRIVE%\tools
|
|
|
|
|
2023-02-23 10:36:59 +01:00
|
|
|
echo.
|
|
|
|
rem remove passwords from settings.cmd config files ...
|
|
|
|
for %%A in (
|
|
|
|
%DRIVE%\tools\%SCRIPT_SETTINGS%
|
|
|
|
%DRIVE%\tools\%COMPANY_SETTINGS%
|
|
|
|
) do (
|
|
|
|
if EXIST %%A (
|
|
|
|
tools\searchreplace %%A "^.*SET.*LOCALADMIN_PASSWORD.*=.*" "set localadmin_password=DELETED"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
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
|
2023-02-20 10:35:26 +01:00
|
|
|
echo "usage: %0 <DRIVE>"
|
2021-02-24 22:26:55 +01:00
|
|
|
echo.
|
2021-01-10 15:49:37 +01:00
|
|
|
|
|
|
|
:END
|
|
|
|
|